“pod init” giving error “-bash: pod: command not found”

南楼画角 提交于 2021-02-06 07:05:05

问题


I am trying to create a Podfile for my Xcode project for Firebase compatibility, but when I try to create it within the same file that my Xcode project is stored in, using my terminal and typing "pod init", it throws the error "-bash: pod: command not found".

I am up to date on OSX as far as I'm aware, using Sierra 10.12.1, but I am unfamiliar with the use of Podfiles, so any help here would be great, thanks.


回答1:


Looks like you didn't install CocoaPods.

To do that you install it through ruby gems, like this:

sudo gem install cocoapods

If you don't have admin privileges, try:

gem install cocoapods --user-install



回答2:


if the 1st command doesn't work, try the 2nd command

sudo gem install cocoapods

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

In my case, the 2nd command worked




回答3:


For OS Catalina (as of December 2019)

gem install -n /usr/local/bin cocoapods



回答4:


Got this error today. Was able to resolve it by making sure I had ruby in my PATH.

export PATH=/usr/bin/ruby:$PATH

Then (as suggested by answers above) run

sudo gem install cocoapods

Or

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



回答5:


Brew install

$ brew install cocoapods      

For me sudo gem install cocoapodsdid not work.
When I tried $sudo gem install -n /usr/local/bin cocoapods it threw me weird error messages. But brew install was pretty neat.




回答6:


I ran into this problem yesterday, I reckon others in my situation will be too. So I am running a mac OS siera on a virtual machine on my windows so I can use xcode. Firstly you will need to update your version of ruby, it has been answered here: https://stackoverflow.com/a/38194139/7451779.

Once updated this just run: $ sudo gem install cocoapods

After all this $ pod init should work



来源:https://stackoverflow.com/questions/41064579/pod-init-giving-error-bash-pod-command-not-found

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