Skip to content

Instantly share code, notes, and snippets.

@gangelo
Last active March 12, 2024 14:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gangelo/7597bda321702a354cdcdea23ad66f2a to your computer and use it in GitHub Desktop.
Save gangelo/7597bda321702a354cdcdea23ad66f2a to your computer and use it in GitHub Desktop.
Install new ruby version for M1 macs
#/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