Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a gem or update RubyGems if it fails with a permissions error

I'm trying to install a gem using gem install mygem or update RubyGems using gem update --system, and it fails with this error:

ERROR:  While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. 

Does anyone have an idea how to solve this?

like image 541
Gaurav Avatar asked Jan 30 '13 15:01

Gaurav


People also ask

How do I download RubyGems?

Open up the 'Software Center' app from your launcher and type in `RubyGems` without quotes into the application search box at the top right, and press [enter]. RubyGems then can be installed by just clicking on the button labeled 'Install', thats it.


1 Answers

Try adding --user-install instead of using sudo:

gem install mygem --user-install 
like image 143
nathanwhy Avatar answered Sep 23 '22 07:09

nathanwhy