Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Install the latest Homebrew precompiled Ruby with the chruby Ruby version switcher.
# Install Homebrew if you haven't already:
/usr/bin/ruby -e "$(curl -fsSL"
# Install the latest stable Ruby and chruby:
brew install ruby chruby
# Symlink brew Ruby to ~/.rubies where chruby will autodetect it:
mkdir -p "$HOME/.rubies"
ln -s "$(brew --prefix ruby)" "$HOME/.rubies/ruby-$(brew ls --versions ruby | cut -d" " -f2)"
# Add the following to your ~/.bashrc or ~/.zshrc file
# and run them once in your terminal or reload your terminal:
source /usr/local/opt/chruby/share/chruby/
source /usr/local/opt/chruby/share/chruby/
# Switch to brew Ruby:
chruby ruby
# Switch to system Ruby:
chruby system
# Optionally set a default Ruby:
echo "ruby-2" > "$HOME/.ruby-version"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.