Do not use MacOS system Ruby

MacOS comes with a "system Ruby" pre-installed. Some developers use the system Ruby for running sysadmin scripts. That's fine, as long as you don't alter the system Ruby by attempting to update or add gems. You should not use it when you are developing projects in Ruby. Instead, you should Install Ruby with Homebrew or use a version manager such as asdf, chruby, rbenv, or rvm (see recommendations for the best version manager for Ruby in the guide Install Ruby Mac). See the article Do Not Use the MacOS System Ruby for reasons. Basically, the system Ruby is there for macOS, not for you.