0

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
Cœur
  • 37,241
  • 25
  • 195
  • 267
Faiz Fareed
  • 1,498
  • 1
  • 14
  • 31
  • Possible duplicate of [Operation not permitted - /usr/bin/update\_rubygems](https://stackoverflow.com/questions/33015875/operation-not-permitted-usr-bin-update-rubygems) – Cœur Oct 22 '18 at 04:35
  • Your comment seems to link to a different problem. I already posted an answer here with a relevant solution. – Cœur Oct 23 '18 at 02:06

3 Answers3

1

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
Cœur
  • 37,241
  • 25
  • 195
  • 267
0

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
KlimczakM
  • 12,576
  • 11
  • 64
  • 83
0

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.

Eduardo Oliveros
  • 863
  • 9
  • 20
Learn Swift
  • 570
  • 5
  • 15