Gem Install Permission Problem

Why do I get a permission denied error while installing a gem?

Your Ruby is installed in /usr/local/Cellar/ruby/....

That is a restricted path and can only be written to when you use elevated privileges, either by running as root or by using sudo. I won't recommend you run things as root since you don't understand how paths and permissions work. You can use sudo gem install jekyll, which will temporarily elevate your permissions, giving your command the rights needed to write to that directory.

However, I'd recommend you give serious thought into NOT doing that, and instead use your RVM to install Ruby into your own home directory, where you'll automatically be able to install Rubies and gems without permission issues. See the directions for installing into a local RVM sandbox in "Single-User installations".

Because you have RVM in your ~/.bash_profile, but it doesn't show up in your Gem environment listing, I suspect you either haven't followed the directions for installing RVM correctly, or you haven't used the all-important command:

rvm use 2.0.0 --default

to configure a default Ruby.

For most users, the "Single-User installation" is the way to go. If you have to use sudo with that configuration you've done something wrong.

How to install a gem or update RubyGems if it fails with a permissions error

You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

means exactly that, you don't have permission to write there.

That is the version of Ruby installed by Apple, for their own use. While it's OK to make minor modifications to that if you know what you're doing, because you are not sure about the permissions problem, I'd say it's not a good idea to continue along that track.

Instead, I'll strongly suggest you look into using either rbenv or RVM to manage a separate Ruby, installed into a sandbox in your home directory, that you can modify/fold/spindle/change without worrying about messing up the system Ruby.

Between the two, I use rbenv, though I used RVM a lot in the past. rbenv takes a more "hands-off" approach to managing your Ruby installation. RVM has a lot of features and is very powerful, but, as a result is more intrusive. In either case, READ the installation documentation for them a couple times before starting to install whichever you pick.

Getting permission denied error when I run gem install bundler

you are using the system's ruby and now you need to root level permission to to install bundler. Sudo enables root privileges. Check if your account has root privileges.

I prefer using a version and manager like rbenv. Install rbenv . then install the required version of ruby and then install bundler.

Permission denied error while installing gem

Installing C-extensions on Windows has always been a big and painful problem, as Windows doesn't ship with a compiler. Most gems which are intended to be used on Windows systems publish a specialized gem version with a specific platform field, which then would include pre-compiled binaries. This is not the case for rackamole, otherwise it would be visible here.

Another solution would be to use a version of the gem which uses the newer FFI approach instead of C-extensions to interface with native libraries. I guess this isn't an option here because rackamole, whatever that is, is probably only available with C-extensions.

There once was a Ruby distribution including its own compiler and development headers, but I can't remember the name and I don't know if its still maintained.

Should using Windows not be mandatory, I recommend using a more developer-friendly OS like Ubuntu or Debian in combination with rvm.

gem install permission problem

For a systemwide Ruby install, become root. For example:

$ sudo gem install hpricot

However, the modern approach in many circumstances, including in development, is to use a tool that lets you easily install and use Ruby as a normal user. This lets you avoid having to become root. There are a few such tools, and the one I use is RVM.

# install rvm into your ~
$ \curl -sSL https://get.rvm.io | bash -s stable

# install latest version of ruby into your ~
$ rvm install ruby

# installs a gem into your ~
$ gem install $SOME_GEM_NAME

Permissions error with gem install

Use chmod on the directory something like this:

sudo chmod -R g+w /Library/Ruby/Gems/1.8

That might work.



Related Topics



Leave a reply



Submit