I have two versions of ruby gem.
json (default: 2.0.2, 1.8.6)
Here, the latest version is set to default; however I need json 1.8.6
to be set as default. Is there anyway to make the older versions of the gem as default? cos I am unable to uninstall the default json version. Need a switch between available gem versions.
There are several ways to specify gem versions: Use a specific version: gem "name-of-gem", "1.0" . You can find specific versions on Rubygems.org (provided that's the source you”re using) by searching for your gem and looking at the “Versions” listed. Use a version operator: gem "name-of-gem", ">1.0" .
gem env – try to search in provided list under GEM PATHS, in specifications/default. remove there bundler-VERSION. gemspec. install bundler, if you don't have specific: gem install bundler:VERSION --default.
Check what you have with:
gem list json
Set the one you want:
gem install --default -v1.8.6 json
This is most useful for things like "bundler"!!! For other things, using bundler and a Gemfile is probably a better choice.
Add
gem 'json', '1.8.6'
to your Gemfile
or execute
gem install 'json' -v 1.8.6 # may require sudo if you use system ruby
from terminal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With