"Operation not permitted" while installing CocoaPods on OSX El Capitan (10.11)

OSX El Capitan introduces System Integrity Protection, that prevents even the Mac's administrators from writing to /usr/bin, where CocoaPods defaults its installation to. You run across the following error if you attempt it:

$ sudo gem install cocoapods
Fetching: cocoapods-1.0.1.gem (100%)
ERROR:  While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod

To get around this, you can install CocoaPods into /usr/local/bin where this restriction doesn't apply.

sudo gem install -n /usr/local/bin cocoapods
comments powered by Disqus