flutter doctor - CocoaPods installed but not working
Solution 1
Using the suggestion for this post, I was able to get cocoapods reinstalled with the commands below
gem native extension error while installing cocoapods
Open Terminal
curl -L https://get.rvm.io | bash -s stable
Reopen Terminal
rvm install ruby-2.6
rvm use ruby-2.6.5
rvm --default use 2.6.5
Then this installed cocoapods as expected
sudo gem install cocoapods
Solution 2
Use brew and gem
-
first uninstall by gem
sudo gem uninstall cocoapods
-
Install cocoapods by brew
brew install cocoapods
-
link using brew
brew link --overwrite cocoapods
Solution 3
curl -L https://get.rvm.io | bash -s stable
rvm install ruby-2.6
rvm use ruby-2.6.5
rvm --default use 2.6.5
sudo gem update
sudo gem install ffi
brew install libffi
sudo gem install cocoapods
pod setup
this worked for me
Solution 4
First install brew
package manager for Mac.
https://brew.sh
If you use macOS, system Ruby is not recommended. and you should not use it. its for system specific use. you need to install another one for user.
brew install rbenv
then install the latest version of ruby. as today its 3.1.0
rbenv install 3.1.0
then set the global version of Ruby to be used in all shells
rbenv global 3.1
close the terminal and reopen it again, to affect the changes.
and finally install cocoapods
gem install cocoapods
as you see you don't use sudo
command. because you are not overriding system specific configurations. when you need to use sudo
command means you are doing something that you should avoid it.
if you are using fastlane
and still complaining about cocoapods
, even cocoapods
is installed properly, reinstall fastlane
again:
brew uninstall fastlane
gem install fastlane
Mathias
Started working with dumb terminals a long long time ago doing Cobol on a mainframe. Morphing through many different technologies over the decades. Currently working primarily with Angular.
Updated on December 07, 2022Comments
-
Mathias over 1 year
using zsh - use to work in bash
brew doctor - Your system is ready to brew.
flutter doctor gives this error[!] Xcode - develop for iOS and macOS (Xcode 12.2) ✗ CocoaPods installed but not working. You appear to have CocoaPods installed but it is not working. This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it. This can usually be fixed by re-installing CocoaPods. For more info, see https://github.com/flutter/flutter/issues/14293. To re-install CocoaPods, run: sudo gem install cocoapods
sudo gem install cocoapods
Gives this error dyld: Library not loaded: /usr/local/opt/gmp4/lib/libgmp.3.5.2.dylib Referenced from: /Users/puser/.rvm/rubies/ruby-2.5.1/bin/ruby Reason: image not found zsh: abort sudo gem install cocoapods
I can't get this error above corrected - any suggestions?
which pod
/Users/puser/.rvm/rubies/ruby-2.5.1/bin/pod
which gem
gem () { \typeset result ( \typeset rvmrc rvm_rvmrc_files=("/etc/rvmrc" "$HOME/.rvmrc") if [[ -n "${rvm_prefix:-}" ]] && ! [[ "$HOME/.rvmrc" -ef "${rvm_prefix}/.rvmrc" ]] then rvm_rvmrc_files+=("${rvm_prefix}/.rvmrc") fi for rvmrc in "${rvm_rvmrc_files[@]}" do [[ -s "${rvmrc}" ]] && source "${rvmrc}" || true done unset rvm_rvmrc_files command gem "$@" ) || result=$? hash -r return ${result:-0} }
which ruby
/Users/puser/.rvm/rubies/ruby-2.5.1/bin/ruby
-
anticafe about 3 yearsThanks. It helps me a lot.
-
Sung Jun almost 3 yearsThanks. you save me! I wanna give you additional information. If you are using Flutter on m1. then you should install it like this.
rvm install ruby-2.6 --with-out-ext=fiddle
In my case, the installed version is 2.6.6. so maybe you change this specific version. -
Adeolaex almost 3 yearsCheers!! After hours this finally worked.
-
biniam over 2 yearsThanks. The rvm website recommended to download using
\curl -sSL https://get.rvm.io | bash -s stable
and then I installedrvm install ruby-2.7.2
Make sure you do not have CocoaPods installed using Homebrew and if so,brew uninstall cocoapods
. Then,rvm --default use 2.7.2
andsudo gem install cocoapods
worked for me -
urmish patel over 2 yearsThanks a lot... it's working for me
-
Farhana Naaz Ansari about 2 years@mathias and @Sungjun you saved my time, i have been trying for couple of days, My system has m1 chip and nothing was working for me. My system has multiple ruby versions conflicting with
Cocapods
, your solution fixed everything. -
Ruelos Joel almost 2 yearsi'm also using m1 chip, but not working, is it only me or there are a lot of problems with mac-flutter development? i find it very hard to setup and make it work