bash 安装 CocoaPods 的问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/15869733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Issues installing CocoaPods
提问by Sean
I'm trying to get CocoaPods set up in OSX (I'm running 10.8.2) - so I run
我正在尝试在 OSX 中设置 CocoaPods(我正在运行 10.8.2) - 所以我运行
sudo gem install cocoapods
sudo gem install cocoapods
It succeeds and I get - 'Successfully installed cocoapods-0.17.2 1 gem installed'
它成功了,我得到了 - '成功安装了 cocoapods-0.17.2 1 gem'
Then...I try pod setup'-bash: pod: command not found
'
然后......我尝试pod setup'-bash:pod:未找到命令'
How do I get command line to recognize this command?
如何让命令行识别此命令?
回答by Elliot
Quitting and restarting Terminal fixed it for me. Actually, I just opened a new tab in Terminal.
退出并重新启动终端为我修复了它。实际上,我刚刚在终端中打开了一个新标签。
回答by gterzian
I had the same problem, running Mountain Lion with Ryby 2 installed and being used instead of the standard system ruby.
我遇到了同样的问题,在安装了 Ryby 2 的情况下运行 Mountain Lion,并使用它代替标准系统 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.
以前,我将 PATH=/usr/local/bin:$PATH 添加到我的 .bash_profile 中,以确保自制软件(包括 Ruby 2)安装的内容优先于某些系统内容。
Anyway, in this case I was doing sudo gem install cocoapods
无论如何,在这种情况下,我正在做 sudo gem install cocoapods
and after a succesful install, when trying a 'pod setup' I would get
并在成功安装后,尝试“吊舱设置”时,我会得到
-bash: pod: command not found '
-bash: pod: 命令未找到 '
so I noticed that cocoapods would install their 'pod' binary not in
所以我注意到 cocoapods 会安装他们的“pod”二进制文件而不是
/usr/local/bin
/usr/本地/bin
but rather in
而是在
/usr/local/Cellar/ruby/2.0.0-p247/bin/
/usr/local/Cellar/ruby/2.0.0-p247/bin/
So to my .bash_profile I added
所以在我的 .bash_profile 中我添加了
PATH=$PATH:/usr/local/Cellar/ruby/2.0.0-p247/bin/
PATH=$PATH:/usr/local/Cellar/ruby/2.0.0-p247/bin/
and now cocoapods works like a charm.
现在 cocoapods 就像一个魅力。
回答by CardenB
I had this issue. If you used brew to install ruby and nothing else works for you, try
我有这个问题。如果您使用 brew 安装 ruby 并且没有其他方法适合您,请尝试
brew unlink ruby && brew link ruby
EDIT:
编辑:
I'm on OS X Mavericks 10.9.3
我使用的是 OS X Mavericks 10.9.3
回答by Kaelin Colclasure
It's possible that bash simply isn't finding the newly-installed podcommand. 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:
bash 可能根本找不到新安装的pod命令。当您刚刚在 .git 中的某个随机位置安装了一个新命令时PATH,您通常需要使用以下命令告诉 bash “重新散列”:
$ hash -r
You can then verify that the new command is (or isn't) found using:
然后,您可以使用以下方法验证是否找到(或未找到)新命令:
$ which pod
Quitting and restarting Terminalwill also do the trick, although that's a much heavier hammer.
退出并重新启动终端也可以解决问题,尽管这是一个更重的锤子。

