Issues installing CocoaPods

微笑、不失礼 提交于 2019-12-06 20:26:01

问题


I'm trying to get CocoaPods set up in OSX (I'm running 10.8.2) - so I run

sudo gem install cocoapods

It succeeds and I get - 'Successfully installed cocoapods-0.17.2 1 gem installed'

Then...I try pod setup '-bash: pod: command not found '

How do I get command line to recognize this command?


回答1:


Quitting and restarting Terminal fixed it for me. Actually, I just opened a new tab in Terminal.




回答2:


I had the same problem, running Mountain Lion with Ryby 2 installed and being used instead of the standard system ruby.

Previously I added PATH=/usr/local/bin:$PATH to my .bash_profile as a way to make sure stuff installed by homebrew, including Ruby 2, take precedence over some system stuff.

Anyway, in this case I was doing sudo gem install cocoapods

and after a succesful install, when trying a 'pod setup' I would get

-bash: pod: command not found '

so I noticed that cocoapods would install their 'pod' binary not in

/usr/local/bin

but rather in

/usr/local/Cellar/ruby/2.0.0-p247/bin/

So to my .bash_profile I added

PATH=$PATH:/usr/local/Cellar/ruby/2.0.0-p247/bin/

and now cocoapods works like a charm.




回答3:


I had this issue. If you used brew to install ruby and nothing else works for you, try

brew unlink ruby && brew link ruby

EDIT:

I'm on OS X Mavericks 10.9.3




回答4:


It's possible that bash simply isn't finding the newly-installed pod command. When you've just installed a new command at some random location in your PATH, you often need to tell bash to "rehash" with the following command:

$ hash -r

You can then verify that the new command is (or isn't) found using:

$ which pod

Quitting and restarting Terminal will also do the trick, although that's a much heavier hammer.



来源:https://stackoverflow.com/questions/15869733/issues-installing-cocoapods

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!