Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
brew install rbenv
brew install ruby-build
## Config ####################################################################
# Global git ignore
git config --global core.excludesfile ~/.gitignore
printf "vendor/bundle\n.DS_Store\n" >> ~/.gitignore
# Set default bundle path
mkdir -p ~/.bundle
printf -- "---\nBUNDLE_PATH: vendor/bundle" >> ~/.bundle/config
# Instantiate rbenv with your shell (choose preferred file - .profile, .bash_profile, .zshrc, etc)
printf 'eval "$(rbenv init -)"' >> ~/.profile
# Remove the RVM stuff from your .profile - It probably looks like...
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function
# Reload your profile
. ~/.profile
# Add autocompletion to IRB
touch ~/.irbrc
printf "require 'irb/completion'" >> ~/.irbrc
## Usage #####################################################################
rbenv
# Choose a ruby flavor version to install
rbenv install 1.9.3-p0
rbenv install 1.9.2-p290
# Rehash rbenv shims (run this after installing binaries)
rbenv rehash
# Set the global Ruby version and install bundler globally
rbenv global 1.9.3-p0
gem install bundler --pre
gem install OTHER_GLOBAL_GEMS # eg) Rails, Heroku, etc - NOTE: You need to do this for each ruby version.
rbenv rehash
# Set a project specific ruby version
cd myproject
rbenv local 1.9.2-p290
# Install gems in Gemfile to vendor/bundle
cd ~/projects/newhotness
bundle
# Start app in context of bundled gems
bundle exec rails s
## RubyMine Notes ############################################################
# Open settings | Ruby SDK & Gems
# Remove ALL RVM related SDK's
# Add new Ruby SDK for project - Find path by found by running `rbenv which ruby` in project directory
# Edit launch/debug configurations | Bundler - enable/check - Run the script in the context of bundler
# Note: RubyMine debugger will install some additional needed gems into your global gem path - eg) ~/.gem/ruby/...
@rcdilorenzo

This comment has been minimized.

Copy link

@rcdilorenzo rcdilorenzo commented Jul 8, 2012

Thanks so much!

@julianduque

This comment has been minimized.

Copy link

@julianduque julianduque commented Jul 10, 2012

Hello, you miss to set the PATH to rbenv in .profile.

$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.profile

@stouset

This comment has been minimized.

Copy link

@stouset stouset commented Mar 13, 2013

That path isn't part of rbenv.

@biinari

This comment has been minimized.

Copy link

@biinari biinari commented Apr 15, 2013

Don't need pre-release version of bundler

@joshnesbitt

This comment has been minimized.

Copy link

@joshnesbitt joshnesbitt commented Apr 17, 2013

Thanks for this.

@brentertz

This comment has been minimized.

Copy link
Owner Author

@brentertz brentertz commented Nov 15, 2013

To avoid rehashing all of the time, have a look at https://github.com/sstephenson/rbenv-gem-rehash

@christophermlne

This comment has been minimized.

Copy link

@christophermlne christophermlne commented Mar 9, 2014

thanks.

this has solved so many headaches for me.

@gilesvangruisen

This comment has been minimized.

Copy link

@gilesvangruisen gilesvangruisen commented Mar 24, 2014

This is awesome!

@hollingberry

This comment has been minimized.

Copy link

@hollingberry hollingberry commented Jul 8, 2014

thanks for putting this together!

@kaikuchn

This comment has been minimized.

Copy link

@kaikuchn kaikuchn commented Aug 6, 2014

Thanks a lot! It was very helpful! 👍

@jponc

This comment has been minimized.

Copy link

@jponc jponc commented Aug 15, 2014

Thanks 👍

@mortalfish

This comment has been minimized.

Copy link

@mortalfish mortalfish commented Aug 27, 2014

Awesome! Thanks!

@hellobrian

This comment has been minimized.

Copy link

@hellobrian hellobrian commented Sep 1, 2014

Thank you! super helpful

@shrwnsan

This comment has been minimized.

Copy link

@shrwnsan shrwnsan commented Sep 4, 2014

Thanks!

@wallawe

This comment has been minimized.

Copy link

@wallawe wallawe commented Sep 18, 2014

Good stuff. Thank you!

@hunj

This comment has been minimized.

Copy link

@hunj hunj commented Dec 8, 2014

Thank you!

@pdostal

This comment has been minimized.

Copy link

@pdostal pdostal commented Mar 4, 2015

Nice - I switched from RVM to RBENV in five minutes.

@douglasresende

This comment has been minimized.

Copy link

@douglasresende douglasresende commented Mar 10, 2015

👍

@asampat3090

This comment has been minimized.

Copy link

@asampat3090 asampat3090 commented Jun 5, 2015

Very helpful! rbenv is definitely much less of a headache.

@andersennl

This comment has been minimized.

Copy link

@andersennl andersennl commented Aug 5, 2015

I just used this for switching, thanks a lot!

@ktdmedia

This comment has been minimized.

Copy link

@ktdmedia ktdmedia commented Sep 20, 2015

@christian-acuna

This comment has been minimized.

Copy link

@christian-acuna christian-acuna commented Sep 23, 2015

Awesome!

@poctek

This comment has been minimized.

Copy link

@poctek poctek commented Mar 14, 2017

Thank you! Very helpful!

@Waleeta

This comment has been minimized.

Copy link

@Waleeta Waleeta commented Aug 16, 2017

This was extremely helpful, thank you.

@janaipakos

This comment has been minimized.

Copy link

@janaipakos janaipakos commented Dec 29, 2017

👍

@louismanson

This comment has been minimized.

Copy link

@louismanson louismanson commented May 3, 2018

Great, Thanks

@msuzoagu

This comment has been minimized.

Copy link

@msuzoagu msuzoagu commented May 9, 2018

thank you!

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