Last active
May 20, 2024 13:10
-
-
Save gangelo/7597bda321702a354cdcdea23ad66f2a to your computer and use it in GitHub Desktop.
Install new ruby version for M1 macs
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
#/bin/bash | |
# Place in ~/bin | |
echo "Enter the ruby you want to install. E.g. 2.7.6" | |
echo "NOTE: if the ruby version you want to install is not found," | |
echo "run `brew upgrade ruby-build` to update the ruby build list" | |
echo "and try again. | |
read ruby_version | |
if [ -x "$(command -v rvm)" ]; then | |
if ! rvm install $ruby_version --with-gcc=clang; then | |
cd $HOME/.rvm/src/ruby-$ruby_version | |
make install | |
rvm use $ruby_version --create | |
fi | |
elif [ -x "$(command -v rbenv)" ]; then | |
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix [email protected])" | |
export RUBY_MAKE_OPTS="-j 1" | |
rbenv install $ruby_version | |
rbenv shell $ruby_version | |
else | |
echo "You need to install rvm or rbenv" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment