Last active
December 8, 2021 02:47
-
-
Save havenwood/ba31f67c1d89ac236400 to your computer and use it in GitHub Desktop.
Install the latest Homebrew precompiled Ruby with the chruby Ruby version switcher.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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-3" > "$HOME/.ruby-version" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment