Author of the book, "Learn Ruby on Rails" and founder of the RailsApps open source project.
Is Ruby installed on my Mac?
Ruby comes pre-installed on macOS Catalina and Big Sur (see below why you may not want to use the default Ruby).
To check if Ruby is installed, enter in your terminal application:
$ ruby -v
(Don't type the
If Ruby is not installed, you'll see:
zsh: command not found: ruby
command will confirm that Ruby is missing:
$ which ruby ruby not found
You can use the
command with flag
to see if more than one Ruby executable is installed:
$ which -a ruby /Users/daniel/.asdf/shims/ruby /usr/bin/ruby
If Ruby is installed, the
command will show a response like:
$ ruby -v ruby 2.6.3p62
MacOS comes with a "system Ruby" pre-installed. Use the `which` command to see if you are using the system Ruby:
$ which ruby /usr/bin/ruby
If you see
, it is the pre-installed macOS system Ruby. It's fine to use the system Ruby for running sysadmin scripts, as long as you don't alter the system Ruby by attempting to update it or add gems. But experienced developers don't use the system Ruby for developing projects in Ruby.
You may not want to use the MacOS system Ruby because it is an older version of Ruby. Instead, you can Install Ruby with Homebrew. You could also use a version manager such as asdf, chruby, rbenv, or rvm. A version manager can also help if you're juggling multiple projects that can't be updated all at once.
Also published on Dev.to.
Create your free account to unlock your custom reading experience.