Homebrew suggests the blame is not with Rails.
Every Ruby developer I know users rbenv, rvm or asdf to manage their versions and take the permissions and path woes of competing package managers out of the equation entirely.
You need to know this before you start or you're going to have a bad time.