Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cocoa Pods not updating pods on El Capitan

I've upgraded to El Capitan and since then I can't update my pods.

$ pod update
-bash: pod: command not found

So I've tried to reinstall CocoaPods and got this:

$ sudo gem install cocoapods
ERROR:  While executing gem ... (Errno::EPERM)
    Operation not permitted - /usr/bin/xcodeproj

I am the administrator on this computer. Why is this happening?

like image 720
Luda Avatar asked Oct 12 '15 09:10

Luda


3 Answers

This is caused by the new System integrity protection feature introduced in El Capitan. It restricts even administrators from writing to /usr/bin.

Your best option would be to install gems without needing sudo. There is a good guide on how to do that:

export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH

gem install cocoapods
like image 146
Keith Smiley Avatar answered Oct 20 '22 12:10

Keith Smiley


From CocoaPods issues 3736

  1. Uninstall all instances of cocopods (just to be safe and keep things clean) see fully uninstall Cocoapods

    sudo gem uninstall cocoapods
    

    or even better fully uninstall all components (and select All versions for each)

    gem list --local | grep cocoapods | awk '{print $1}' | xargs sudo gem uninstall
    
  2. Install again

    sudo gem install -n /usr/local/bin cocoapods
    
  3. Change access permission

    sudo chmod +rx /usr/local/bin/
    
like image 8
Warif Akhand Rishi Avatar answered Oct 20 '22 13:10

Warif Akhand Rishi


This should work for you

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

Operation not permitted - /usr/bin/xcodeproj #3692

For whatever reason, the rootless stuff seems less restrictive when one simply upgrades the system. I could sudo gem install cocoapods just fine on a machine upgraded from 10.10 - however, binstubs are no longer installed into /usr/bin:

$ sudo gem install cocoapods
[...]
1 gem installed
$ export PATH=$PATH:/Library/Ruby/bin
$ pod --version
0.37.2

We have heard from some users that they receive this error when doing a system-wide installation:

ERROR: While executing gem ... (Errno::EPERM) Operation not permitted - /usr/bin/pod

We aren't sure why gem behaves differently on some systems, but this can be solved by passing -n /usr/local/bin to the install command, so that the pod executable gets installed there.

like image 7
Inder Kumar Rathore Avatar answered Oct 20 '22 12:10

Inder Kumar Rathore