Skip to content

Instantly share code, notes, and snippets.

@greglearns
Forked from brentertz/rvm2rbenv.txt
Last active December 21, 2015 03:48
Show Gist options
  • Save greglearns/6244384 to your computer and use it in GitHub Desktop.
Save greglearns/6244384 to your computer and use it in GitHub Desktop.
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew update
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 -)"' >> ~/.bash_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
. ~/.bash_profile
# Add autocompletion to IRB
touch ~/.irbrc
printf "require 'irb/completion'" >> ~/.irbrc
## Usage #####################################################################
rbenv
# Choose a ruby flavor version to install
rbenv install 2.0.0-p247
# Rehash rbenv shims (run this after installing binaries)
rbenv rehash
# Set the global Ruby version and install bundler globally
rbenv global 2.0.0-p247
gem install bundler
gem install rerun rb-fsevent # 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment