Install chruby to replace rvm on OS X
RVM to chruby on OS X
For various reasons, I chose to drop rvm and move onto chruby.
Removing RVM
rvm implodegem uninstall rvm- Remove references to rvm in any .bashrc, .bash_profile, .profile, .zprofile, or .zsrsh files
Installing chruby using homebrew
I use Homebrew whenever I can. Learn more about Homebrew here
brew install chruby- Add
source /usr/local/share/chruby/chruby.shinto your~/.bashrcfile - Add
source /usr/local/share/chruby/auto.shinto your~/.bashrcfile as well. This will tell chruby to automatically switch to the correct ruby version when you change directories into something like your rails app's root directory. It does this by looking up a file called .ruby-version. If you don't have that file, create one at the root of your rails project or wherever your ruby scripts are located. Note: you'll have to follow the ruby-install steps to get the right ruby versions. echo "source ~/.bashrc" >> ~/.bash_profile- restart terminal
Installing ruby-install
The ruby-install gem is what I use to install ruby versions that chruby then picks up from the ~/.rubies directory automatically.
brew install ruby-install- restart terminal
Installing ruby versions
RVM installs the ruby versions for you, but chruby only helps you switch, which is why we will use the ruby-install gem.
-
ruby-install rubyThis will install the latest stable version of ruby into your ~/.rubies directory. If you have a.ruby-versionfile at the root of your rails app, chruby will find it and switch for you automatically or if/when you specify. -
ruby-install ruby 1.9.3is an example of installing another version of ruby.
Conclusion
That's it. Using chruby is pretty simple, as it doesn't need shims and is easy to follow and fix if you need. It's comparable to rvm and rbenv, but the simplicity is what I like.
Written by Arthur Chang
Related protips
2 Responses
Thanks. It helps a lot.
How can I use specific version of rails with chruby ?
over 1 year ago
·
Thanks for the post. Quick question, what's the proper way to switch the ruby version when you're in another project?
over 1 year ago
·
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Ruby
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#