Reputation: 2271
I'm running the install with an admin account I tried
sudo gem install cocoapods
and
sudo gem install cocoapods -n /usr/local/bin
They both run fine with following output
Fetching cocoapods-1.9.1.gem
Successfully installed cocoapods-1.9.1
Parsing documentation for cocoapods-1.9.1
Installing ri documentation for cocoapods-1.9.1
Done installing documentation for cocoapods after 2 seconds
1 gem installed
however, a simple
pod --version
Returns
zsh: command not found: pod
I'm not too good at managing users accounts or dealing with command shell but I scoured the net and couldn't find a solution. It looks like wherever pod is installed, it doesn't make it to the list of executable applications
Upvotes: 19
Views: 79494
Reputation: 11
Use for M1, M2 M3 chipset if the brew command not working in the terminal after homebrew installation success in the system.
eval "$(/opt/homebrew/bin/brew shellenv)"
Upvotes: 1
Reputation: 5844
In my case, I already had the pod
executable, but it wasn't in my PATH. For context, I've installed Ruby via Homebrew.
First I found where the executable is:
$ find /usr/local -type f -name "pod"
/usr/local/lib/ruby/gems/3.2.0/bin/pod
/usr/local/lib/ruby/gems/3.2.0/gems/cocoapods-1.14.2/bin/pod
…then I opened my ~/.profile
and added it to the PATH:
export PATH="/usr/local/lib/ruby/gems/3.2.0/bin:$PATH"
Note: I have .profile
loaded in both my .bash_profile
:
$ cat ~/.bash_profile
source ~/.profile
…and my .zprofile
:
$ cat ~/.zprofile
emulate sh
source ~/.profile
emulate zsh
…so both bash and zsh get the updated PATH.
Upvotes: 1
Reputation: 3899
I tried the above answers installing Ruby with rvm
, but it failed because of make error. Here is how I installed it with rbenv
:
rbenv
:brew install rbenv
rbenv
:rbenv init
You'll need to follow the printed instructions to set up rbenv
integration with your shell. This is a step you'll only need to do once.
rbenv install 2.7.4
rbenv global 2.7.4
ruby -v
sudo gem install cocoapods
Upvotes: 1
Reputation: 547
If you're encountering the "zsh: command not found: pod" error after successfully installing CocoaPods, it could be due to the pod
executable not being included in your system's PATH. To resolve this issue, you can try the following steps:
/usr/local/bin/
directory. Run the following command in terminal:ls /usr/local/bin/pod
open ~/.zshrc
export PATH="$PATH:/usr/local/bin"
source ~/.zshrc
pod --version
It should display the version number of CocoaPods if the setup was successful.
But if the pod executable is not present in the /usr/local/bin/
directory after installing CocoaPods, it might be due to an issue during the installation process. To troubleshoot this, you can try the following steps:
ruby --version
gem --version
If both commands display the version numbers without any errors, proceed to the next step. Otherwise, you may need to reinstall Ruby and CocoaPods.
gem environment
Look for the line that starts with "INSTALLATION DIRECTORY". Make a note of the path listed next to it.
ls <INSTALLATION_PATH>/bin/pod
open ~/.zshrc
export PATH="<INSTALLATION_PATH>/bin:$PATH"
source ~/.zshrc
pod --version
If the pod command displays the version number of CocoaPods, then the setup was successful.
If you're still experiencing issues after following these steps, it's recommended to uninstall and reinstall CocoaPods using a different method, such as using a package manager like Homebrew.
Upvotes: 23
Reputation: 1695
I followed these instructions but ended up with the same issue. So I ran gem list | grep cocoapods
and then uninstalled every instance of cocoapods with gem uninstall cocoapods
along with the executables. Then I decided to install cocoapods using Homebrew with brew install cocoapods
, restarted my Mac and the pod command was available. Remember I didn't restart my Mac after using sudo gem install cocoapods
,maybe that will work too, you can try.
Upvotes: 22
Reputation: 2271
The issue was that command line for XCODE was not installed.
First I updated to latest Ruby version and put the version number in the second command (in place of [version]
curl -L https://get.rvm.io | bash -s stable
rvm install ruby-[version]
During the install you will see the Software update available from MAcOS popup. Install immediately and continue with prompts in that window (I believe it asks for updates and then asks for install.
It will take a while to run / download / install (it took 2 expressos for me :) )
After that I ran
sudo gem install cocoapods
And restarted my terminal. Now checking it's installed
pod --version
Returns the installed version (1.9.1 for me)
Upvotes: 28