Upgrade Ruby to the lastest version on MacOS with Homebrew

Upgrade Ruby to the lastest version on MacOS with Homebrew

keep in sync with the outside world

Recently when installing some gems, it popped out errors that telling me the Ruby version is lower than required… I have to upgrade the shipped Ruby, version 2.0.0p648 (2015-12-16 revision 53162), on my MacBook. There are a few methods dealing with this issue, but I found the easiest way is using Homebrew.

If you’re using newer versions of macOS that shipped with newer ruby version, I’d recommend you not upgrade it…

Check current version of Ruby

Type following line in terminal:

ruby -v

It says ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16] on macOS Sierra, quite old 🤔.

Install Homebrew

Okay, if you haven’t used Homebrew before, just paste the following command into terminal to install it:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Get more information about Homebrew, please go to its official website: https://brew.sh.

Install Ruby with Homebrew


brew install ruby

One simple line is enough, Homebrew will install all the stuff you needed without any further configuration.

In recent macOS updates (Catalina or Big Sur…), you need to configure the brew installed ruby to the PATH.

👉 for bash user:

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile

👉 for zsh user:

echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.zshrc

After ruby installation finished, just restart your terminal and check the version of Ruby with ruby -v, that will show you the latest stable version.

Ads by Google


Frank Lin

Hey, there! This is Frank Lin (@flinhong), one of the 1.41 billion . This 'inDev. Journal' site holds the exploration of my quirky thoughts and random adventures through life. Hope you enjoy reading and perusing my posts.


Setup an IKEv2 server with strongSwan



Setup an IKEv2 server with strongSwan

IKEv2, or Internet Key Exchange v2, is a protocol that allows for direct IPSec tunnelling between networks. It is developed by Microsoft and Cisco (primarily) for mobile users, and introduced as an updated version of IKEv1 in 2005. The IKEv2 MOBIKE (Mobility and Multihoming) protocol allows the client to main secure connection despite network switches, such as when leaving a WiFi area for a mobile data area. IKEv2 works on most platforms, and natively supported on some platforms (OS X 10.11+, iOS 9.1+, and Windows 10) with no additional applications necessary.


Ads by Google