Cocoapods: "pod: command not found" after installing on OS X El Capitan Beta 2

Created on 26 Jun 2015  Â·  67Comments  Â·  Source: CocoaPods/CocoaPods

Trying to setup an OS X Server Mac Mini with El Capitan Beta 2 so I can try out the new Xcode server stuff. I'm able to run "sudo gem install cocoapods", and it seems to install everything properly without errors, but when I run "pod setup" I get the command not found error. Happens even after closing the current Terminal window and opening a new one.

Is there an issue specific to the 10.11 beta? I've been able to install cocoapods on my other macs (albeit I installed cocoapods way before I installed the 10.11 beta on those machines)

Most helpful comment

Update with solution:

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

will install 'pod' to a writeable place. From http://stackoverflow.com/a/32883578/701926 - give him an upvote if it helps you.

Original problem:

Same here - trying to re-install cocoapods fails:

richard$ pod install
-bash: pod: command not found
richard$ sudo gem install cocoapods
Password:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod

I suspect it is related to:

http://arstechnica.co.uk/apple/2015/09/os-x-10-11-el-capitan-the-ars-technica-review/8/#h1

which would block an install to /usr/bin - should be to /usr/local/bin

Trying it without 'sudo' in case it then finds local places to install fails too:

richard$ gem install cocoapods
Fetching: cocoapods-0.38.2.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

All 67 comments

What's the output of gem list ?

I have the same problem.
cocoa pods gets install just fine and its also in the gem list, but I can't call any commands.

See https://github.com/CocoaPods/CocoaPods/issues/3692#issuecomment-113847612, binstubs are installed in a directory that is not part of the standard PATH when using OS X 10.11

i have got the same problem...oh no ...

I tried the #3690 but it still not finding the pod command line. tells me it does not exist.

Same issue here. :-1:

Same for me

Piling on doesn't really help anyone — you have to tell us what you tried and why that didn't work for you.

Got the same problem after upgrading to 10.11

gem install cocoapods solved it for me.

Update with solution:

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

will install 'pod' to a writeable place. From http://stackoverflow.com/a/32883578/701926 - give him an upvote if it helps you.

Original problem:

Same here - trying to re-install cocoapods fails:

richard$ pod install
-bash: pod: command not found
richard$ sudo gem install cocoapods
Password:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod

I suspect it is related to:

http://arstechnica.co.uk/apple/2015/09/os-x-10-11-el-capitan-the-ars-technica-review/8/#h1

which would block an install to /usr/bin - should be to /usr/local/bin

Trying it without 'sudo' in case it then finds local places to install fails too:

richard$ gem install cocoapods
Fetching: cocoapods-0.38.2.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory.

@richardgroves interesting, I guess there's a problem with existing installations in the El Capitan Ruby there. Could you try uninstalling and then reinstalling CocoaPods?

@neonichu - Installing El Capitan wipes out the old version of cocoapods - the Ars Technica article has a link to where it 'migrates' all the files it finds in places it didn't like.

Hmmm....looks like the old versions are there - just the front end 'pod' launcher that got wiped:

richard$ pod --version
0.38.2
richard$ sudo gem uninstall cocoapods

Select gem to uninstall:

  1. cocoapods-0.32.1
  2. cocoapods-0.33.1
  3. cocoapods-0.34.1
  4. cocoapods-0.35.0
  5. cocoapods-0.35.0.rc2
  6. cocoapods-0.36.3
  7. cocoapods-0.37.1
  8. cocoapods-0.37.2
  9. cocoapods-0.38.0
  10. cocoapods-0.38.2
  11. All versions

10
Successfully uninstalled cocoapods-0.38.2
richard$ which pod
/usr/local/bin/pod
richard$ pod --version
0.38.0

So after uninstalling the 0.38.2 I still have the previous one working.

and then a straight install to get back to the latest fails:

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

leaving me at 0.38.0 until I use the '-n /usr/local/bin' positioning argument.

@MarsCWD - that will work (disabling the whole SIP system) but is a bit heavy handed.

@richardgroves I can't reproduce this, if I uninstall all existing CP installations on OS X 10.11 and then reinstall, /usr/local/bin is used automatically.

when i want reinstall cocoapods i got his :

sudo gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://rubygems.org/latest_specs.4.8.gz)

@neonichu Interesting - I wonder if there is a config setting in Ruby gems that indicates where to put things? The machine I'm on has also done updates from several previous OS X versions so might have inherited an install location from an old version?

@richardgroves yah, I am assuming that is the case. I have updated the instructions in this comment to reflect the -n workaround if that happens. Thanks for reporting!

Try the following command on OS X El Capitan
sudo gem install -n /usr/local/bin cocoapods

thanks for your suggestion @MVakas. It solved the issue for me

@MVakas : thanks !! worked like a charm !
Guess we can close the issue.

I just installed el capitan and ran into the same issue than you guys.

I did as @MVakas said, but I had to change permissions of /usr/local/bin/

with sudo chmod +rx /usr/local/bin/

After running this command, solved
sudo chmod -R 755 /usr/local/bin

The config problem appears to be in /Library/Ruby/Site/2.0.0/rubygems/defaults.rb - around line 118:

#

# The default directory for binaries

def self.default_bindir
if defined? RUBY_FRAMEWORK_VERSION then # mac framework support
'/usr/bin'
else # generic install
RbConfig::CONFIG['bindir']
end
end

it is setting up what is basically a not-allowed in OS X 10.11 directory to install binaries too. I'm on Ruby 2.0.0, so don't know if this is changed in the newer 2.2.3 build. The folder was the same back in 1.8 - http://stackoverflow.com/a/333639/701926

Interesting, that configuration file doesn't even exist on my 10.11 installation. Maybe it's an upgrade leftover in certain situations?

Just updated to 2.2.3 using brew & rbenv - so that has moved everything into a local folder in my user account which should solve future problems. Here's hoping the bad bindir setup is some legacy issue that will fade out rapidly.

I have filed a radar on this: http://www.openradar.me/22979372 — but pretty sure nothing will come out of it because it is way too vague.

Got a reply for the radar:

We need more information to investigate this issue.

What is your RubyGems version? If you've installed a newer version then it won't install into /usr/local/bin unless you use
-n /usr/local/bin
The rubygems shipped with El Capitan will report
$ gem env
...

  • EXECUTABLE DIRECTORY: /usr/local/bin
    ...

Please provide your response or results by updating your bug report.

Could y'all check your gem env and verify if you updated RubyGems?

Gems version...
RUBY VERSION: 2.0.0 (2015-04-13 patchlevel 645) [universal.x86_64-darwin15]

After running .... sudo gem install -n /usr/local/bin cocoapods pod is available once more.

Interesting...

I ran sudo gem install -n /usr/local/bin cocoapods and all looked good. So I moved on to update the pods in my project.

I ran pod update on the target project and got this output.

Analyzing dependencies dyld: warning, LC_RPATH @executable_path/../../../../../../../SharedFrameworks in /Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework/Versions/A/../../..//DVTInstrumentsFoundation.framework/Versions/A/DVTInstrumentsFoundation being ignored in restricted program because of @executable_path dyld: warning, LC_RPATH @executable_path/../lib in /Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework/Versions/A/../../../../Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libclang.dylib being ignored in restricted program because of @executable_path dyld: warning, LC_RPATH @executable_path/../lib in /Applications/Xcode.app/Contents/Frameworks/IDEFoundation.framework/Versions/A/../../../../Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib being ignored in restricted program because of @executable_path dyld: warning, LC_RPATH @executable_path/../Frameworks in /Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/MacOS/Xcode3Core being ignored in restricted program because of @executable_path Downloading dependencies

@Bizzi-Body that's just warnings, they're going to be silenced in a future release (see CocoaPods/Xcodeproj#312)

@neonichu - thanks for clarifying.

@richardgroves Thanks for the help!

This solution worked for me, updated to El Capitan from Yosemite yesterday.

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

@CoderMJLee You are right! Thank Teacher Li.

same here

Like many of you, I had the same problem. Unfortunately for me nothing worked until I stumbled on one of the comments above posted by @darioalessandro -

As he suggested, I had to change permissions of /usr/local/bin/

The process I did, in case it's helpful to anyone, is below:

1) uninstall all instances of cocopods (just to be safe and keep things clean) sudo gem uninstall cocoapods
2) sudo gem install -n /usr/local/bin cocoapods
3) sudo chmod +rx /usr/local/bin/

After that, my pod commands all worked from the console as it used to before migration to El Capitan

@CoderMJLee You are right! Thanks

Tried the various commands posted in this thread but nothing works for me..
Posted the log below:-

ERROR:  Error installing cocoapods:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling generator.c
In file included from generator.c:1:
In file included from ./../fbuffer/fbuffer.h:5:
In file included from                       /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.1 0.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby.h:33:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/include/ruby-2.0.0/ruby/ruby.h:24:10: fatal error: 'ruby/config.h' file not found
#include "ruby/config.h"
^
1 error generated.
make: *** [generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/json-1.8.3 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-15/2.0.0/json- 1.8.3/gem_make.out

@footyapps27 that looks like as if you are using the wrong version of Xcode, you can't install gems with Xcode 6 on OS X 10.11

Just use xcode-select -s (Xcode 7 version path) then
sudo gem install -n /usr/local/bin cocoapods

I tried all the above. The only thing that worked was the solution @the-scott-davis suggested. Thanks!

@sicaboy sudo chmod -R 755 /usr/local/bin solved my problem

I had the same problem and solved it.
My process is below:
1.sudo chmod -R 755 /usr/local/bin
2.sudo gem uninstall cocoapods
3.sudo gem install -n /usr/local/bin cocoapods
4.sudo ./xcode-select -switch /Applications/Xcode.app/

@CoderMJLee I fix it with this.

I had the same issue after upgrading to 10.11.1
I've fixed it with:

$ sudo gem uninstall cocoapods
Remove executables:
    pod, sandbox-pod

in addition to the gem? [Yn]  Y

then

$  gem install cocoapods

@CatchZeng thanks...you helped me

+1 @the-scott-davis

+1 @the-scott-davis Thanks a lot,it's worked.

+1 @the-scott-davis

I was wondering if anyone has come across this running Xcode Server?

I tried the-scott-davis suggestions, and others, all to no avail.

I'm still getting the "pod: command not found." The weird thing is, Xcode Server runs as user _xcsbuildd. If I "su" to that user and do a "pod --version", no problem, it finds the command. But if I run a bot, with a script that has "pod install" in it, it's like the command doesn't exist. Any help would be greatly appreciated.

+1 I have the same problem as @skydivedan. I tried all the things I could but nothing worked yet.

@the-scott-davis It works. Thank you.

@skydivedan I made it work easily at the end. Just do as @the-scott-davis said above and add one more step :
Add the following in your bot trigger script export PATH=$PATH:/usr/local/bin so that the bot can look there as well and find the binary.

Hope that helps.

You can also just run :
gem uninstall cocoapods
(All versions + Executables)
gem install cocoapods

Worked for me

Removing all versions and sandbox of CocoaPods and installing it again solved the problem for me.

Uninstall: sudo gem uninstall cocoapods
Install: sudo gem install cocoapods

We can also make it work for local gem installation (a sudo-less one):

  1. Follow instructions from the official cocoapods installation guide: https://guides.cocoapods.org/using/getting-started.html#sudo-less-installation
  2. Run the following script:

echo "export PATH=\$PATH$(gem env gempath)/bin" | sed 's/:/\/bin:/g' | sed 's/$PATH/$PATH:/g' >> ~/.bash_profile

  1. Restart terminal and run pod --help to check whether it works.

@MVakas Legend!

+1 @the-scott-davis Thanks!

I ran sudo "chmod +rx /usr/local/bin/" and It can work as before

Thanks..everyone @MVakas...

Thanks... @MVakas

wait a minute.... Cocoapods 1.0 just rolled out. Shouldn't this have been addressed in the big 1.0 update? Or will "sudo gem install" always need a path argument?

This happens because of a new security level in El Capitan, you can disable SIP or have the install use the -n flag along with the /usr/local/bin path however the route cause is the updated security model.

i have tried all bellow Commands in os X 10.11.04 ....still iam getting this error
ERROR: While executing gem ... (NoMethodError)
undefined method `ord' for nil:NilClass

==>
sudo gem install -n /usr/local/bin cocoa pods

sudo gem install cocoapods
sudo gem install -n /usr/local/bin cocoapods
pod setup
pod setup --verbose

sudo gem install activesupport -v 4.2.6
sudo gem install cocoapods

sudo gem install activesupport -v 4.2.6
sudo gem install cocoa pods

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

[sudo] gem install activesupport -v 4.2.6
[sudo] sudo gem install cocoapods

sudo gem install cocoapods -V
sudo gem update --system

@the-scott-davis help me, thanks
30802c42-3b72-44e6-ad98-43020d81a6d6

Try this Commands

sudo gem install activesupport -v 4.2.6 ,
sudo gem install cocoa pods ,

sudo gem install cocoapods -V , sudo gem update --system

On Sunday, October 16, 2016, RMKitty [email protected] wrote:

@the-scott-davis https://github.com/the-scott-davis help me, thanks
[image: 30802c42-3b72-44e6-ad98-43020d81a6d6]
https://cloud.githubusercontent.com/assets/11688968/19415116/18de79e4-9398-11e6-9004-48bbd1fefe9d.png

—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
https://github.com/CocoaPods/CocoaPods/issues/3736#issuecomment-254026104,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AQ2yL8EzFc6fBRVSP_1V9KJEubuhzTfUks5q0aHlgaJpZM4FMQxG
.

when i run pod setup
i found some error that
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master

Cloning into 'master'...
error: RPC failed; curl 56 SSLRead() return error -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed

how to solve
waiting..........

Was this page helpful?
0 / 5 - 0 ratings

Related issues

soleares picture soleares  Â·  3Comments

Mingmingmew picture Mingmingmew  Â·  3Comments

pronebird picture pronebird  Â·  3Comments

Curtis-Halbrook picture Curtis-Halbrook  Â·  3Comments

gerchicov-bp picture gerchicov-bp  Â·  3Comments