Last active
March 12, 2024 14:57
-
-
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" | |
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 openssl@1.1)" | |
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