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

Thomas Anthony
seal-mask
.a{fill-rule:evenodd;}techdegree
Thomas Anthony
iOS Development Techdegree Student 22,352 Points

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.

Charles Franklin
Charles Franklin
17,535 Points

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

Thomas Anthony
seal-mask
.a{fill-rule:evenodd;}techdegree
Thomas Anthony
iOS Development Techdegree Student 22,352 Points

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.

Daniel Peñaloza
Daniel Peñaloza
3,292 Points

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

Thomas Anthony
seal-mask
.a{fill-rule:evenodd;}techdegree
Thomas Anthony
iOS Development Techdegree Student 22,352 Points

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.