Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

write permissions for gem install bundler

I've just started installing ruby on rails. Everything in the setup was going fine until I tried to install the Gems. I received this error

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

any help would greatly be appreciated

4 Answers

You need to specify the sudo command before you gem install because you do not have write permissions for the /Library/Ruby/Gems/2.0.0 directory. sudo is a shell command that gives you elevated privileges and allows you to perform system-level operations without switching to the root user. Be very cautious, however. Make certain you double check your commands before execution. It is very easy to perform a command that could potentially cause irreversible damage i.e. sudo rm -rf / (NEVER DO THIS!!!).

Make note, you will have to use the sudo command each time you gem install unless you perform some rather advanced account configurations.

Thanks for this.. I ran into the same problem..

I still get an "Operation not permitted" when using "sudo gem install bundler" Here's a screenshot

I will need more information about your system to help you. What OS are you running?

I was using OSX 10.10 and just updated to 10.11 beta. Still have the same issue.

It is just as I suspected. Some users that migrated to the beta release of El Capitan have reported their system running "rootless". You may solve this problem if you set the firmware nvram variable boot-args to "rootless=0". Simply run this set of commands: sudo nvram boot-args="rootless=0"; sudo reboot. When your system reboot completes, try running sudo gem install bundler again. Let me know if this information solved your problem. Good luck.

You are the man! It worked like a charm.

Have the same problem. Copy the set of commands and the terminal answer :"syntax error near unexpected token `;;' " Any idea what can i do?

It seems as though the markdown interpreter HTML-escaped the " characters within the back-ticks. At the time of writing, this was not an issue (I suppose it interprets the code as HTML by default). I have updated my answer to account for this. You should be able to copy and paste the command as-is.