pod install -bash: pod: command not found

IosCocoapodsPod Install

Ios Problem Overview


I installed pod some time ago. However, it's stopped working so I'm working through this again.

However, I almost immediately run into a problem here:

pod install
-bash: pod: command not found

Any suggestions why this happened?

Ios Solutions


Solution 1 - Ios

OK, found the problem. I upgraded Ruby some time ago and blasted away a whole load of gems. Solution:

sudo gem install cocoapods

For none-sudo use:

export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH
gem install cocoapods --user-install

Solution 2 - Ios

Installing CocoaPods on OS X 10.11

These instructions were tested on all betas and the final release of El Capitan.

Custom GEM_HOME

This is the solution when you are receiving above error

$ mkdir -p $HOME/Software/ruby
$ export GEM_HOME=$HOME/Software/ruby
$ gem install cocoapods
[...]
1 gem installed
$ export PATH=$PATH:$HOME/Software/ruby/bin
$ pod --version
0.38.2

Solution 3 - Ios

This Step Is Proper Working.

Pod Install

[ 1 ] Open terminal and type:

sudo gem install cocoapods

Gem will get installed in Ruby inside the System library. Or try on 10.11 Mac OSX El Capitan, type:

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

If there is an error "activesupport requires Ruby version >= 2.xx", then install the latest active support first by typing in the terminal.

sudo gem install activesupport -v 4.2.6

[ 2 ] After installation, there will be a lot of messages, read them and if no error found, it means cocoa pod installation is done. Next, you need to set up the cocoa pod master repo. Type in terminal:

pod setup

And wait it will download the master repo. The size is very big (370.0MB in Dec 2016). So it can be a while. You can track the download by opening Activity and go to the Network tab and search for git-remote-https. Alternatively, you can try adding verbose to the command like so:

pod setup --verbose

[ 3 ] Once done it will output "Setup Complete", and you can create your XCode project and save it.

[ 4 ] Then in a terminal cd to "your XCode project root directory" (where your .xcodeproj file resides) and type:

pod init

[ 5 ] Then open your project's podfile by typing in terminal:

open -a Xcode Podfile

[ 6 ] Your Podfile will get open in text mode. Initially, there will be some default commands in there. Here is where you add your project's dependencies. For example, in the podfile, type

/****** These are Third party pods names ******/
pod 'OpenSSL-Universal'
pod 'IQKeyboardManager'
pod 'FTPopOverMenu'
pod 'TYMActivityIndicatorView'
pod 'SCSkypeActivityIndicatorView'
pod 'Google/SignIn'
pod 'UPStackMenu'

(this is For example of adding library to your project).

When you are done editing the podfile, save it and close XCode.

[ 7 ] Then install pods into your project by typing in terminal:

pod install

Depending on how many libraries you added to your podfile for your project, the time to complete this varies. Once completed, there will be a message that says

"Pod installation complete! There are X dependencies from the Podfile and X total pods installed."

Solution 4 - Ios

You have to restart Terminal after installing the gem. Or you can simply open a new tab Terminal to fix.

Solution 5 - Ios

For macOS:

brew install --cask cocoapods

Original answer (outdated):

brew install cocoapods
brew cask install cocoapods-app

Solution 6 - Ios

I had the same problem, running Mountain Lion with Ruby 2 installed and used instead of 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, took precedence over system-installed binaries.

Anyway, in this case 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 is working like a charm.

Solution 7 - Ios

for M1mac people first install cocoapods

brew install cocoapods  

and if you are doing this for ios react-native

pod install

Solution 8 - Ios

  1. Uninstall all instances of cocopods by this command

     $sudo gem uninstall cocoapods
    
  2. sudo gem install -n /usr/local/bin cocoapods

  3. sudo chmod +rx /usr/local/bin/

Solution 9 - Ios

try: rbenv global system and then sudo gem install cocoapods pod setup

Solution 10 - Ios

Try this:

sudo gem install cocoapods -V

and you must update gem to the newest release using this:

sudo gem update --system 

if you want to enjoy the fast responce :)

Solution 11 - Ios

Sudo-less installation

If you do not want to grant RubyGems admin privileges for this process, you can tell RubyGems to install into your user directory by passing either the --user-install flag to gem install or by configuring the RubyGems environment. The latter is in our opinion the best solution. To do this, create or edit the .profile file in your home directory and add or amend it to include these lines:

export GEM_HOME=$HOME/.gem
export PATH=$GEM_HOME/bin:$PATH

Note that if you choose to use the --user-install option, you will still have to configure your .profile file to set the PATH or use the command prepended by the full path. You can find out where a gem is installed with gem which cocoapods. E.g.

$ gem install cocoapods --user-install
$ gem which cocoapods
/Users/eloy/.gem/ruby/2.0.0/gems/cocoapods-0.29.0/lib/cocoapods.rb
$ /Users/eloy/.gem/ruby/2.0.0/bin/pod install

Source: https://guides.cocoapods.org/using/getting-started.html

Solution 12 - Ios

In terminal it's better to run installation of the cocoa pods with "sudo". In other case I'm getting an error: "You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory."

So the solution is:

sudo gem install cocoapods

Solution 13 - Ios

so I also had the same problem. This is probably happening because your computer has an older version of ruby. So you need to first update your ruby. Mine worked for ruby 2.6.3 version.I got this solution from sStackOverflow,

You need to first open terminal and put this code

curl -L https://get.rvm.io | bash -s stable

Then put this command

rvm install ruby-2.6

This would install the ruby for you if it hasn' t been installed.After this just update the ruby to the new version

rvm use ruby-2.6.3

After this just make ruby 2.6.3 your default

rvm --default use 2.6.3

This would possibly fix your issue. You can now put the command

sudo gem install cocoapods

And the command

pod setup

I hope this was useful

Solution 14 - Ios

This solution worked for me. Make sure to not miss the last command (export PATH=$PATH:$HOME/Software/ruby/bin).

See This.

Solution 15 - Ios

install cocoapods from https://cocoapods.org/app

Commands & versions keep onchanging

so download tar and enjoy

Solution 16 - Ios

gterzian is on the right track, however, if you later update your version of ruby then you'll also have to update your .profile to point to the new versioned ruby directory. For instance, the current version of ruby is 2.0.0-p353 so you'd have to add /usr/local/Cellar/ruby/2.0.0-p353/bin to your path instead.

A better solution is to add /usr/local/opt/ruby/bin to your PATH. /usr/local/opt/ruby is actually a symlink to the current version of ruby that homebrew automatically updates when you do an upgrade. That way you'll never need to update your PATH and always be pointing to the latest version.

Solution 17 - Ios

If you used homebrew to install ruby, this answer worked for me.

brew unlink ruby && brew link ruby

OSX 10.9.4

Solution 18 - Ios

it happens to me when I wrote

gem install cocoapods

instead of

sudo gem install cocoapods

if sudo command is not found also, write

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:$PATH

before sudo command

Solution 19 - Ios

@Babul Prabhakar was right

IMPORTANT: However,if you still get "pod: command not found" after using his solution, this command could solve your problem:

sudo chown -R $(whoami):admin /usr/local

Solution 20 - Ios

The best solution for Big Sur is posted on Redit by _fgmx

Go into Xcode 12 preferences Click locations Select Xcode 12 for Developer tools/command line tools Install cocoapods for Xcode 12: sudo gem install cocoapods

Solution 21 - Ios

Please remove the Ruby folder from -Your Disk->Library->Ruby Deleting this folder and use sudo gem install cocoapods command to solve my issue. enter image description here

Solution 22 - Ios

This worked for me

sudo apt-get install ruby-dev
sudo gem install cocoapods

Solution 23 - Ios

We were using an incompatible version of Ruby inside of Terminal (Mac), but once we used RVM to switch to Ruby 2.1.2, Cocoapods came back.

Solution 24 - Ios

Install pod sudo gem install cocoapods

Navigate inside platforms/ios cd platforms/ios

Run pod install

Solution 25 - Ios

I'm using OS Catalina and used the solution of Babul Prabhakar. But when I closed the terminal, pod still was unable.

So I put the exports:

$ export GEM_HOME=$HOME/Software/ruby
$ export PATH=$PATH:$HOME/Software/ruby/bin

inside this file(put this command below inside the terminal):

nano ~/.bash_profile

Then save the file, close the terminal and open it up again and type:

pod --version

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionSnowcrashView Question on Stackoverflow
Solution 1 - IosSnowcrashView Answer on Stackoverflow
Solution 2 - IosBabul PrabhakarView Answer on Stackoverflow
Solution 3 - Iossaurabh rathodView Answer on Stackoverflow
Solution 4 - IosShaheen GhiassyView Answer on Stackoverflow
Solution 5 - IosHappyFaceView Answer on Stackoverflow
Solution 6 - IosgterzianView Answer on Stackoverflow
Solution 7 - IosParasView Answer on Stackoverflow
Solution 8 - IosShaheenView Answer on Stackoverflow
Solution 9 - IosAllenView Answer on Stackoverflow
Solution 10 - IosMohsinView Answer on Stackoverflow
Solution 11 - IosPer Quested AronssonView Answer on Stackoverflow
Solution 12 - Iosuser1195202View Answer on Stackoverflow
Solution 13 - IosAyush KovindView Answer on Stackoverflow
Solution 14 - Iosnaveed148View Answer on Stackoverflow
Solution 15 - IosvijayView Answer on Stackoverflow
Solution 16 - IosKoppaceticView Answer on Stackoverflow
Solution 17 - IosYPCrumbleView Answer on Stackoverflow
Solution 18 - IosNoraView Answer on Stackoverflow
Solution 19 - IosSomnusLeeView Answer on Stackoverflow
Solution 20 - IosIgor KuzminView Answer on Stackoverflow
Solution 21 - IosGurpreet SinghView Answer on Stackoverflow
Solution 22 - IosAfzal AliView Answer on Stackoverflow
Solution 23 - IosCrashalotView Answer on Stackoverflow
Solution 24 - IosRanjoy SenView Answer on Stackoverflow
Solution 25 - IosHelder Itiro AlvesView Answer on Stackoverflow