I am new to programming and trying to install Rails on Mac Yosemite v10.10, but I get the following error when running $ gem install rails
. How do I avoid this error and install rails?
ERROR: While executing gem ... (Errno::EACCES) Permission denied - /Users/usename/.rbenv/versions/2.0.0-p481/lib/ruby/gems/2.0.0/gems/rails-4.1.7/README.md
I'm using ruby version 2.0.0p481.
You could make this:
sudo chown -R "$USER": ~/.rbenv
This function for me.
Your rbenv installation was incorrectly installed as it had elevated privileges which caused your user account to not have write access to ~/.rbenv.
Do sudo chown -R pgrennin ~/.rbenv
. This will take ownership of the directory
You probably accidentally installed rails
with sudo
before. This installed Rails files owned by root
and not you, so now you can't update them. To fix this you'll have to repossess those files with chown
:
sudo chown -R "$USER" ~/.rbenv
( "$USER"
is a variable that contains your username)
If using rbenv
rbenv local 2.0.0-p247 before gem install bundler
more reference : https://github.com/rbenv/rbenv#readme
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.