Topic: gems won't install - 'no permission' and run-time error

Sorry, I'm a huge noob so my bad if this is an easy fix.

I'm trying to install rmagick and some other gems, but when I try to type


sudo gem install rmagick



in my iTerm, I got a permissions error. So I went to those folders and tried changing the chmod for them to 775.


Now, when I try to install, I get this error:

ERROR:  While executing gem ... (RuntimeError)
    ERROR: Failed to build gem native extension.
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/rmagick-1.15.3 for inspection.





Any help with how to fix this would be appreciated. Thanks.