$ brew install rbenv
$ which ruby
/Users/<username>/.rbenv/shims/ruby
$ which gem
/Users/<username>/.rbenv/shims/gem
# Ruby
eval "$(rbenv init -)"
Mac comes with an older version of ruby, at the time of this document 2.6.0 is the latest ruby that has been released
$ rbenv install 2.6.0
$ rbenv shell 2.6.0
Now you can install gems, install newer versions of ruby, and switch versions of ruby as needed without messing with the apple permissions for the mac installed ruby
$ gem update --system
$ gem install rspec