Remove rbenv and any rubies, gems etc.:
$ rm -rf ~/.rbenv
Uninstall rbenv if installed via Homebrew
$ brew uninstall rbenv
Remove references to rbenv in ~/.bash_profile
etc.
Install chruby as per https://github.com/postmodern/chruby
For easy of use I decided to add the following to ~/.bash_profile
RUBIES=(/Users/chris/.rubies/rub*)
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
The first line ensures I know where my rubies are installed, and the latter line auto-switches ruby versions, honouring the setting in .ruby-version
when entering a directory.
Open a new shell so the above takes effect.
Install rubies via ruby-build https://github.com/sstephenson/ruby-build
Because I've now no gems, install Bundler
$ gem install bundler
At this stage, I still need project-specific gems. Previously I've used rbenv-gemset (and prior to that rvm's own management). Now I decided to just rely on Bundler.
So, go to each project and:
- Switch to the required ruby using
chruby
- Put that ruby version in a
.ruby-version
file
Then Bundle as follows:
$ bundle install --path vendor
$ bundle package --all
$ echo 'vendor/ruby' >> .gitignore
Tips for the above came from http://ryan.mcgeary.org/2011/02/09/vendor-everything-still-applies/
Use bundle exec rails server
etc., as before
Note, chruby supports auto-detection of Rubies in
~/.rubies/
and/opt/rubies/
. Also, you can configure chruby to use rbenv's rubies.