Faiz Fareed
Faiz Fareed

Reputation: 1548

cocoapods, Gem::FilePermissionError

I am on Mac version 10.11.3 OS X El Capitan I am facing following error while updating cocoapods to latest version.

You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

enter image description here

I also tried:

sudo gem install cocoapods -pre

Upvotes: 0

Views: 2854

Answers (3)

Cœur
Cœur

Reputation: 38667

Starting with El Capitan, Apple prevents user applications to modify /usr/bin for security reasons. So just install/update rubygems in the recommended folder, /usr/local/bin:

sudo gem install cocoapods -n /usr/local/bin --pre

Upvotes: 2

Learn Swift
Learn Swift

Reputation: 580

Since you installed the beta version, I don't recommend installing with

sudo gem install cocoapods -pre

if you use -pre you gonna install the beta version, Instead, use

sudo gem installcocoa pods

Your main problem is that, and you didn't use sudo to give the necessary permissions.

Upvotes: 0

KlimczakM
KlimczakM

Reputation: 12914

You don't have permissions to install gems. You had to use sudo before so now your permissions aren't correct.

Easy solution:

Run this command with sudo:

sudo gem install cocoapods -pre

Better solution - install cocoapods for this user only:

gem install --user-install cocoapods -pre

Another solution - fix your permissions:

sudo chown -R YOUR_USERNAME:YOUR_GROUP ~/.rvm
sudo chown -R YOUR_USERNAME:YOUR_GROUP ~/.gem

or

sudo rvm fix-permissions YOUR_USERNAME:YOUR_GROUP

Upvotes: 0

Related Questions