Skip to content

Instantly share code, notes, and snippets.

@traumverloren
Last active March 29, 2024 00:54
Show Gist options
  • Star 47 You must be signed in to star a gist
  • Fork 6 You must be signed in to fork a gist
  • Save traumverloren/fa5c30056319992c4dab to your computer and use it in GitHub Desktop.
Save traumverloren/fa5c30056319992c4dab to your computer and use it in GitHub Desktop.
Switch from RVM to rbenv

Switch from RVM to rbenv:

Get Rid of RVM if it's installed:

rvm implode

Cleanup your .bash_profile/.bashrc/.zshrc file to remove RVM from the path:

You should have something like this left from RVM. Delete it from the file. ``[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"```


Ensure your homebrew is working properly and up to date:
brew doctor
brew update

Install Rbenv via homebrew:
brew install rbenv
brew install ruby-build
Add ~/.rbenv/bin to your $PATH for access to the rbenv command-line utility:

Afterwards you'll still need to run rbenv init. You'll only ever have to do this once.

(NOTE: Zsh note: Modify your ~/.zshrc file instead of ~/.bash_profile.)

Restart your shell so that PATH changes take effect!

(Opening a new terminal tab will usually do it.) Now check if rbenv was set up by typing rbenv into the terminal. You should see something like this:

rbenv 0.4.0
Usage: rbenv <command> [<args>]

Some useful rbenv commands are:
   commands    List all available rbenv commands
   local       Set or show the local application-specific Ruby version
   global      Set or show the global Ruby version
   shell       Set or show the shell-specific Ruby version
   install     Install a Ruby version using ruby-build
   uninstall   Uninstall a specific Ruby version
   rehash      Rehash rbenv shims (run this after installing executables)
   version     Show the current Ruby version and its origin
   versions    List all Ruby versions available to rbenv
   which       Display the full path to an executable
   whence      List all Ruby versions that contain the given executable

See `rbenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/sstephenson/rbenv#readme

Yay, works!


Using rbenv:

To see a list of available Ruby versions for install:
rbenv install -l

PRO-TIP: Don't see the ruby version listed you are looking for (aka specified in your gemfile?)? Then you probably are due for a brew update! brew update & brew upgrade ruby-build

Check the Ruby versions list again...
rbenv install -l
To install a ruby version:
rbenv install 2.3.0
Before you can bundle and install gems, add bundler:
gem install bundler
Then you can bundle & install all the gems in the gemfile!
cd your-project-folder
bundle install
Set a project specific (local) ruby version:
cd your-project-folder
rbenv local 2.3.0

Rbenv info: https://github.com/rbenv/rbenv#installation

Removing RVM tips: https://richonrails.com/articles/uninstalling-rvm

@blazetango
Copy link

I bundle install was completed and the application worked fine, but when i leave the folder and cd in to the rails application folder again it ask me to bundle install again for the same application. please help

@Lucas-Masaba
Copy link

I would like to switch from rbenv to rvm instead. Any solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment