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

How do I enable write permissions for a directory?

While entering gem install awesome_print in the terminal, I get:

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

What can I do to fix this? I looked in stackoverflow, and I could not find a suiting solution.

Thank you!

If you are on a linux box you can give it full control also here is a Stack article on the same issue.

http://stackoverflow.com/questions/18599889/error-while-executing-gem-gemfilepermissionerror

chmod -777 /Library/Ruby/Gems/2.0.0

i think thats the correct command look up man chmod if linux box

A directory never need to be 777 instead it should be 755

3 Answers

Try using "sudo gem install awesome_print"

Thank you everyone for the input. I used the sudo gem install awesome_print command and it worked, which is kinda odd since I used it before and I received the same message.

What happened is that I needed to update my Rails version, and once I did that then I was able to install the awesome_print gem using the sudo command.

Thank you James Barnett and Adam Shields