Can't install Rails on Mac---don't have write permissions


I am on the lesson “Your first Rails applications.” When I type in “gem install rails” into Terminal on my Mac, I get the following error:

Fetching: concurrent-ruby-1.0.5.gem (100%)
ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions for the /Library/Ruby/Gems/2.3.0 directory.

(I already have some kind of installation of Ruby, I don’t know about rails though). When I Google this error, the suggested solutions tell me to use Environment Managers. But I want to figure out how to install Rails, The Odin Project way.


Can I just type in “sudo gem install rails”? Or does that run the risk of messing something up?

[I tried typing in “rails” and it said it wasn’t installed…and suggested typing in the above command].


Hi @wkdewey

It sounds like you’ve installed Ruby using sudo which you shouldn’t be doing. Can you link to which instructions you are following please?


I believe I followed the instructions here:


I followed their instructions at, to type in sudo chown -R “$USER” ~/.rbenv and that solved the problem. Rails is now installing.