Richard
Richard

Reputation: 4546

install ruby gem (no write permissions)?

I get this error while trying to install sass Should I use sudo before the install statement?

rd-macbook-pro:~ redres$ gem install css_parser
ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.
rd-macbook-pro:~ redres$ 

thanks, Rich

Upvotes: 3

Views: 7250

Answers (3)

Mohammad Arif
Mohammad Arif

Reputation: 7581

The reason of the error is because you are not logged in as the root user on terminal.

If you already have root use enable on your mac in terminal type (without the $)

$ su

If you dont have root user, you need to enable it using the following steps

  1. From the Apple menu choose System Preferences….
  2. From the View menu choose Users & Groups.
  3. Click the lock and authenticate as an administrator account.
  4. Click Login Options….
  5. Click the “Edit…” or “Join…” button at the bottom right.
  6. Click the “Open Directory Utility…” button.
  7. Click the lock in the Directory Utility window.
  8. Enter an administrator account name and password, then click OK.
  9. Choose Enable Root User from the Edit menu.
  10. Enter the root password you wish to use in both the Password and Verify fields, then click OK.

More at the same on http://support.apple.com/kb/ht1528

Atleast it works for me after getting stuck for couple of hours.

Upvotes: 0

Eugene Rourke
Eugene Rourke

Reputation: 4934

Yes you can use sudo or set gem path

mkdir -p /Users/redres/.gem/ruby/1.8
export GEM_PATH=/Users/redres/.gem/ruby/1.8
export GEM_HOME=/Users/redres/.gem/ruby/1.8

but i highly recommend to try using RVM https://rvm.io/rvm/install/

curl -L https://get.rvm.io | bash -s stable

to install and

rvm requirements

to get further information

Upvotes: 4

Femaref
Femaref

Reputation: 61437

If you aren't using a ruby version manager (like rvm or rbenv), you'll need to use sudo to install on system-level.

Upvotes: 1

Related Questions