I am trying to install cocoapods to my MacBook Pro running with OSX 10.9.1 (new Mavericks) and after type gem install cocoapods
I get the following error:
I fixed the problem by using ruby 2.0 (which is the preferred way on mavericks) or greater. In case you are using rvm just change to the correct ruby with:
rvm use ruby-2.0
After that gem install cocoapods
worked correctly. To be more specific, I was using:
OSX 10.9.2
ruby-2.0.0-p353
cocoapods-0.32.1
The same initial issue occurred when attempting to setup GoogleMaps in a Flutter app after running pod install
on the iOS directory.
Running pod install
the following error appeared:
zsh: /usr/local/bin/pod: bad interpreter: /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby: no such file or directory
Next, after running sudo gem install cocoapods
that resulted in another error similar to that shown at ERROR: Error installing cocoapods: ERROR: Failed to build gem native extension.
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
kevin recommends installing Xcode Developer Tools running:
xcode-select --install
and while highlighting the need to install the tools, the system again produced the same error as before when running the pod install
command.
Refresing the tools by removing and reinstalling them became the next target. The tools are removed with the following command:
rm -rf /Library/Developer/CommandLineTools
And again installing the xcode developer tools using:
xcode-select --install
Then, sudo gem install cocoapods
and pod install
ran successfully.
If none of above works then follow these steps
If you get error like this '
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory
.'
then go to step 3
Run following command
brew cleanup -d -v
Then run below command
brew install cocoapods
Note: If you see failed to link then run brew link cocoapods
This is how it get solved for me
First install Homebrew if you don't have it: https://brew.sh/index_pt-br
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Second, install ruby if you don't have it: https://www.ruby-lang.org/pt/documentation/installation/
brew install ruby
You can also follow these steps: https://gist.github.com/monicao/d372716cdfbb7e9cf692
Then, close your terminal and reopen it again.
Always use sudo to install cocoapods:
sudo gem install cocoapods
I fix the problem by follow step:
1:rvm install 2.0.0
2:rvm list * ruby-1.9.3-p545 [ x86_64 ] => ruby-2.0.0-p451 [ x86_64 ]
3:rvm 2.0.0 —default
4:pod update