How to install the latest Ruby on MacOS Monterey (12.0)
I recently wiped my laptop and started with a clean install of MacOS Monterey (12.0). This post documents how I setup my local enviroment to run Jekyll so I can update this website more often.
Before you start
Before you start, make sure you have the Command Line Tools for Xcode downloaded, and installed before you attempt any of this
Install Homebrew.
Before you copy/paste the following command, I highly recommend you verify that it’s the same command as listed on Homebrew’s website
1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Install rbenv and helpers.
1
2
3
brew install rbenv ruby-build rbenv-gemset rbenv-vars
rbenv init
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/main/bin/rbenv-doctor | bash
If everything above goes well, you need to make sure you modify your .zshrc, or .bashrc, or whatever shell you prefer, to load rbenv on subsequent invocations.
I added this to the bottom of my .zshrc
Modify your shell startup script.
1
2
export RUBY_CONFIGURE_OPTS="--with-openssl-dir=$(brew --prefix openssl@1.1)"
eval "$(rbenv init -)"
Install the latest version of Ruby.
Check what the latest version is at https://www.ruby-lang.org/en/
1
2
rbenv install 3.0.2
rbenv global 3.0.2
Confirm you are using the latest ruby, open a new shell.
1
2
ruby -v
ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin21]
Now you can go to the directory of your project, and just run bundle install
1
2
3
cd work/luther.io
bundle install
bundle exec jekyll s --config _config.yml,_config_dev.yml
That’s it. Hope this post was helpful.