Member-only story
Getting Started with Ruby on MacOS
Keep your Ruby environment tidy :D
If you’re starting out with Ruby or Ruby on Rails development, you’ll want to know:
- How to properly install Ruby on Mac.
- How to setup a local development environment that doesn’t conflict with
brew
or an existing install of Ruby 2.7 Mac
In this tutorial, you’ll learn how to do both! If you have the new macOS M1 laptops, don’t worry, this tutorial also works for installing Ruby on Mac M1.
Never run brew install ruby
Some guides and blog articles will instruct you to install Ruby by running brew install ruby
or updating your existing Ruby versions on a macOS by running the update ruby mac
command. I highly recommend you avoid that completely.
That said, Reddit user postmodern shared on a Ruby thread that you could probably instruct the brew
installation to be explicitly installed onto a different directory. Brew by default installs to /usr/local
and according to postmodern, this doesn’t interfere with the Apple system Ruby scripts because their interpreter location is hardcoded to /usr/bin/ruby
. They also point out that Apple has plans for deprecating their pre-installed versions of Python, Ruby, and Perl.
Why can’t you use system Ruby on Mac?
If you run commands that change your native Ruby version, such as brew install ruby
or brew uninstall ruby
…