"pod init" giving error "-bash: pod: command not found"
Asked Answered
L

6

31

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.

Lancelle answered 9/12, 2016 at 16:15 Comment(2)
Did you install the cocoapods gem?Shorts
No I didn't, I actually didn't realise it had to be installed manually, it's working now though after installation, thanks.Lancelle
S
65

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
Shorts answered 9/12, 2016 at 16:47 Comment(0)
A
21

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

Archine answered 25/4, 2019 at 13:3 Comment(0)
S
11

For OS Catalina (as of December 2019)

gem install -n /usr/local/bin cocoapods
Sipple answered 27/12, 2019 at 2:47 Comment(0)
L
9

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.

Listerism answered 8/12, 2020 at 22:54 Comment(2)
Tried this. But was getting error, Could not find CFProprtyList. So tried sudo gem install cocoapods and it worked. Not sure what happened though. If someone could explain, that would be great!Stew
Brew worked. Even when Cocoapods installed via the traditional method, I couldn't pod init as pod wasn't found. Not sure if it helps but I'm running on Big Sur.Isthmus
S
2

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
Shamekashameless answered 4/7, 2019 at 11:6 Comment(0)
B
0

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://mcmap.net/q/49240/-how-can-i-update-ruby-version-2-0-0-to-the-latest-version-in-mac-os-x-v10-10-yosemite.

Once updated this just run: $ sudo gem install cocoapods

After all this $ pod init should work

Biotin answered 10/7, 2018 at 8:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.