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 https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
# 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/chruby.sh | |
source /usr/local/opt/chruby/share/chruby/auto.sh | |
# 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