Ruby management tool
I prefer use rbenv
to manage ruby versions.
Ruby
Install a new version of ruby with rbenv, change the default ruby version to the new one.
Then, we can start playing.
First, the gem
localtion is changed and you need to check the correctness.
Notice: When you changed the ruby
version, you might need to install a bundler
for that ruby. And the bundle
will use your current ruby. If you go to the bundle website, it didn’t tell you how to change ruby version is used. Because it cannot.
ruby -> gem -> bundle
change ruby version
1 | $ echo "2.6.4" > /Users/zihaozhao/.ruby-version |
check gem env
1 | $ gem env |
check bundle env
1 | $ bundle env |
Now bundle install
will install the gems to ruby 2.6.4.
ruby structure
Let’s see the different ruby(2.4.4 and 2.6.4):
1 | 🤓 versions $ tree /Users/zihaozhao/.rbenv/versions -L 3 |
Let’s see the gems in ruby 2.6.4:
1 | 🤓 versions $ tree /Users/zihaozhao/.rbenv/versions/2.6.4/lib/ruby/gems/ -L 3 |
We can see we have different cli
program we can use under bin
folder. Install some of ruby gems can give you a new cli
.
And gems
are installed in lib
folder. Bundler
is just a special gem that give you new cli
.
Notice: bundler-1.17.2 is the default bundler when I install ruby 2.6.4. The bundler-2.2.11 is installed by using gem install bundler
command.