30

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.

Ethan Humphries
  • 1,786
  • 3
  • 19
  • 28

6 Answers6

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
Caleb Kleveter
  • 11,170
  • 8
  • 62
  • 92
20

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

Diptendu Das
  • 3,990
  • 7
  • 22
  • 38
11

For OS Catalina (as of December 2019)

gem install -n /usr/local/bin cocoapods
Samarey
  • 722
  • 1
  • 7
  • 17
8

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.

Rohit Singh
  • 16,950
  • 7
  • 90
  • 88
  • 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! – Harshal Karande Jul 09 '21 at 17:57
  • 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. – mondousage Jul 05 '22 at 22:35
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
asaf am
  • 1,345
  • 15
  • 28
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://stackoverflow.com/a/38194139/7451779.

Once updated this just run: $ sudo gem install cocoapods

After all this $ pod init should work

Haider Malik
  • 1,581
  • 1
  • 20
  • 23