I am trying to install create a new app in Ruby on Rails and I cannot get passed this error:
$ gem install pg
ERROR: While executing gem ... (Errno::EACCES)
Permission denied # rb_sysopen - /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/2.3.0/gems/pg-0.21.0/.gemtest
Its a permissions issue. You could fix it with this:
sudo chown -R $(whoami) /Library/Ruby/Gems/*
or possibly in your case
sudo chown -R $(whoami) /Users/stormyramsey/.rbenv/versions/2.3.2/lib/ruby/gems/*
What does this do:
This is telling the system to change the files to change the ownership to the current user. Something must have gotten messed up when something got installed. Usually this is because there are multiple accounts or users are using sudo to install when they should not always have to.
It's likely there's a permissions problem somewhere along the .rbenv path. You might try turning on write privileges for your user with:
$ chmod -R +w ~/.rbenv
That will recursively (-R) change the file mode (chmod) to write permission (+w) for all files and directories under your user's .rbenv path. There's no particular reason for not having files set to write.
For Mac M1 systems try,
Allowing full disk access to terminal.
Apple->systemPreferences->Security&Privacy->privacy(Tab)->'+' button, check in Terminal application.
Then Restart terminal
2.Try using,
sudo chflags noschg
Delete the pod folder, reinstall it again. If it doesn't work use this command:
sudo pod install --allow-root
It really doesn't matter on mac how you configure your eyaml create the dir and config manually, add some public key location to it, and its works just fine after adding full disk access to the terminal as Kewin suggested ^ ^. Thumbs up.
No need to change permission, just export GEM_HOME:
export GEM_HOME="$HOME/.gem"
please run:
sudo gem install pg
Related
When running bundle install, I get the error
There was an error while trying to write to
'/Users/my-user/.bundle/cache/compact_index/rubygems.org.443.29b0360b937aa4d161703e6160654e47/versions'.
It is likely that you need to grant write permissions for that path.
I am on Ruby version 2.3.3 using platform x86_64-darwin18.
Are they any suggestions on how to fix this error?
I have already tried unlocking the file, but it says that the file cannot be unlocked and only provides me with the opportunity to make a duplicate copy.
Can you try,
1) chown -R USERNAME /Users/my-user/.bundle/cache/compact_index/
2) sudo bundle install
3) bundle exec bundle install
4) Just give the permission to chown -R USERNAME /Users/my-user/.bundle/cache/
5) rm -rf /Users/my-user/.bundle/cache
Replace the USERNAME with your system username
I am writing a script where I am updating the ruby gems by bundle update command but it is asking the password with message Enter your password to install the bundled RubyGems to your system:
I have to pass the password silently without knowing user or in other ways i have to make it as automated.
currently I have do this with system command as system 'bundle update'
How can I do this.
Thanks.
Due to the way you installed ruby, you need sudo privileges in order to run bundle update.
If you would like to run the bundle command without sudo privileges, you need to chown the gem folders.
You can do this by cd-ing into the path of your gems, and then sudo chown -R username:groupname
I have a ~/.rvm file that has some subdirectories owned by user (anthony) and some owned by root. This is causing issues when I am trying to gem install.
I am tempted to run sudo chown -R anthony:staff ~/.rvm so I have full user control over the entire .rvm folder.
Is this ok/desired?
Thanks!
all files / directores should be owned by user, to fix it run:
rvm fix-permissions
to avoid this problem in future just try to avoid using sudo or rvmsudo it should be never required (rvm uses sudo internally when it is required).
I'm new to ruby version manager and when i tried to install rails after installing it, I get this error . I tried to search other SO questions as well but didn't want to re-install ruby version manager. Even though when I try sudo for installation, it doesn't work.
The error I get is as follows:"ERROR: While executing gem ... (Errno::EACCES)Permission denied # dir_s_mkdir - /home/sunil/.gem/specs"
I would do this:
ls -ld /home/sunil/.gem/specs to check that folder permissions.
whoami to compare current user with /home/sunil/.gem/specs permissions
Maybe chown -R sunil:sunil ~/.gem to change owner in case .gem directory is not owned by sunil.
Maybe chmod -R u+rwX,go+rX,go-w ~/.gem to change permissions.
I had a very weird problem yesterday, where in the middle of trying to figure out some heroku problems, my whole Rails environment just disappeared. Bundle, RVM, rails, etc were no longer recognized. So I just ignored the possible cause and reinstalled everything. Mostly worked, but now I'm running into permissions problems. If I bundle install, it needs me to input my computer password for permission.
And I just ran into the following problem trying to "gem install heroku" in a new directory I wanted to deploy.
ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
Any idea how I get those permissions back so things run smoothly again?
Thanks!
Use chmod on the directory something like this:
sudo chmod -R g+w /Library/Ruby/Gems/1.8
That might work.