mac,

Install Ruby on Mac

Oct 30, 2021 · 2 mins read · Post a comment
Install Ruby on Mac

There are four ways to install Ruby on all computing platforms, including package management systems, installers, managers, and of course building from source. RVM as a Ruby version manager, is my personal favorite, since it’s easy and convenient to setup. Although the installation steps are pretty much the same on any platform, the focus will be on Mac this time.

Prerequisites

  • Homebrew

Solution

Step 1. Update brew.

$ brew install gnupg

Step 2. Install GnuPG.

$ brew install gnupg

Step 3. Install the GPG keys required for the RVM installation.

$ gpg --keyserver hkp://pool.sks-keyservers.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB

Note: If you receive the following error gpg: keyserver receive failed: No name, alternatively import the keys:

$ curl -sSL https://rvm.io/mpapis.asc | gpg --import -
$ curl -sSL https://rvm.io/pkuczynski.asc | gpg --import -

Step 4. Install the stable version of RVM.

$ curl -sSL https://get.rvm.io | bash -s stable

Step 5. Verify the installation.

$ rvm list

Output:

No rvm rubies installed yet. Try 'rvm help install'.

Note: If you get rvm command not found make sure to close all Terminal sessions and open a new one.

Step 6. Install the latest version of Ruby.

$ rvm install ruby --latest

Step 7. Confirm the ruby version.

$ rvm list 

Example output:

=* ruby-3.0.0 [ x86_64 ]

# => - current
# =* - current && default
#  * - default

Conclusion

You might get some warnings along the way, but the installation overall is as easy as it gets.
Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on telegram.