I have an issue that tells me to install cocoapods using gem, but the flutter doctor couldn't find it.
[✓] Flutter (Channel stable, 1.22.4, on macOS 11.0 20A2411 darwin-arm, locale en-IN)
• Flutter version 1.22.4 at /Users/kirandhoundiyal/flutter
• Framework revision 1aafb3a8b9 (3 weeks ago), 2020-11-13 09:59:28 -0800
• Engine revision 2c956a31c0
• Dart version 2.10.4
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
• Android SDK at /Volumes/apps/Android/sdk
• Platform android-30, build-tools 30.0.2
• ANDROID_HOME = /Volumes/apps/Android/sdk
• ANDROID_SDK_ROOT = /Volumes/apps/Android/sdk
• Java binary at: /Volumes/apps/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✗] Xcode - develop for iOS and macOS
✗ Xcode installation is incomplete; a full installation is necessary for iOS
development.
Download at: https://developer.apple.com/xcode/download/
Or install Xcode via the App Store.
Once installed, run:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
✗ 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
[!] Android Studio (version 4.1)
• Android Studio at /Volumes/apps/Android Studio.app/Contents
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[!] Connected device
! No devices available
! Doctor found issues in 3 categories.
Also gem list pod is giving an empty list but sudo gem list pod is giving this
*** LOCAL GEMS ***
cocoapods (1.10.0)
cocoapods-core (1.10.0)
cocoapods-deintegrate (1.0.4)
cocoapods-downloader (1.4.0)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-trunk (1.5.0)
cocoapods-try (1.2.0)
I am first time doing this stuff, need some help, what's wrong?
EDIT: ruby -v gives this ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
which ruby gives this - /usr/bin/ruby
First try this ;
sudo gem uninstall cocoapods
sudo gem install cocoapods
If it does not works for you.
Try this :(It works for me in macos Bigsur M1)
Check permission for the mentioned directory via:
ls -l /home/raphael/flutter/
If not, while being in the folder mentioned above, try to change permission on the folder via:
chown -R YOUR_USERNAME flutter
Run the first command again to verify that the apropriate user is now shown on the folder. Then try to create the project again.
Try resolving issues one by one. First resolve xcode issue using
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -runFirstLaunch
After this
run
sudo gem install cocoapods
===
If this not works give output of following commands. Also can you tell if brew is installed?
$ruby -v
===
$ which ruby
===
I found that I had to first update gem itself:
sudo gem update --system
Then uninstall and reinstall Cocoapods:
sudo gem uninstall cocoapods
sudo gem install cocoapods
Only then would flutter doctor stop complaining that cocoapods was not installed.
Related
so simply i am trying to archive my flutter project using Xcode to push it through apple store connect review process, i faced a problem that declare that the cocoapods version is old .. i am using cocoapods through cocoapods app not the gem ..
i simply uninstalled the app cause it's the lastest version of the app (Not of cocoapods) and then uninstalled any cocoapods related previous gems so that cocoapods is totally uninstalled on my machine (M1 Macbook Air) & installed the cocoapods gem using sudo gem install cocoapods .. on flutter doctor -v in my device ~ it shows me that cocoapods is installed but now working
[!] Xcode - develop for iOS and macOS (Xcode 14.2) • Xcode at /Applications/Xcode.app/Contents/Developer • Build 14C18 ✗ 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. To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
and the weird thing that when i try to re-install cocoapods first i run
gem list --local | grep cocoapods
then i uninstall everything that shows up using sudo gem uninstall command after that when i try flutter doctor -v it still shows me that it's installed but not working, But how when I uninstalled the application and the gems and everything related
Take in mind that when i run pod related command after the gem and application uninstallation it shows me this [!] Unable to locate the CocoaPods.app application bundle. Please ensure the application is available and launch it at least once. zsh: illegal hardware instruction pod.. any Ideas Or Solutions?
System
OS : macOS (12.6.1)
CPU : Intel (R) Core - i5
JAVA : OpenJdk 19
Xcode : 14.1
ruby : 2.7
gems : 3.3.11
Im trying to set up the environment for Kotlin Multiplatform for iOS and Android i installed kdoctor, Xcode, Android Studio,OpenJdk and ruby2.7.
Everything is working according to plan but i'am not able to install cocoapods and cocoapods-genrate i tried official documentation of cocoapods https://guides.cocoapods.org/using/getting-started.html#installation and used this command. but kdoctor is not ditectiong cocoapods,
sudo gem install cocoapods
i also tried brew method by this command
brew install cocoapods
now cocoapods is detected but cocoapods-genrate plugin is not detected. and showed this message
"* cocopods-genrate plugin not found
Get cocopods-genrate from https://github.com/square/cocoapods-generate#installation"
i tred this command but nothing happend.
gem install cocoapods-generate
how to properly install cocopods and cocopods-genrate to set up the environment for Kotlin Multiplatform for iOS and Android?
I used this command to install cocoapods
sudo gem install -n /usr/local/bin cocoapods
Then this command to install cocoapods-generate
sudo gem install -n /usr/local/bin cocoapods-generate
and finaly pod setup --verbose to setup the cocoapods.
I followed this answer and now cocoapods and cocoapods-generate is ditected by kdoctor.
How do I install CocoaPods?
I am not able to run a flutter app that has CocoaPods on my Mac M1 computer.
Flutter run:
Warning: CocoaPods is installed but broken. Skipping pod install.
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.
To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
UPDATE: I updated the ruby version with home-brew but it still gives the same error:
ruby -v ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [x86_64-darwin20]
Update 2.0 I tried installing CocoaPods with homebrew
brew install cocoapods --build-from-source
then: brew link --overwrite cocoapods
flutter clean...
Restarting Android Studio ...
And same error!
Update 3.0 Combination of new Ruby 3.1.2p20 with ffi
brew unlink cocoapods
brew uninstall cocoapods
Try_ing this: https://medium.com/p-society/cocoapods-on-apple-silicon-m1-computers-86e05aa10d3e_
Opening terminal using Rosetta
sudo arch -x86_64 gem install ffi
sudo gem install CocoaPods
--> Says that CocoaPods are not installed
So I try this approach:
https://stackoverflow.com/a/66842555/18936943
1- arch -x86_64 sudo gem install cocoapods -n /usr/local/bin
2- arch -x86_64 sudo gem install ffi
3- pod install
/usr/local/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:128:in `git_version': Failed to extract git version from `git --version` ("") (RuntimeError)
from /usr/local/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:140:in `verify_minimum_git_version!'
from /usr/local/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:49:in `run'
from /usr/local/lib/ruby/gems/3.1.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:25:in `load'
from /usr/local/bin/pod:25:in `<main>'
STILL NO SOLUTION...
Most recent flutter doctor:
timknogel#Tims-MacBook-Pro multiculturalapp % flutter doctor -v
[✓] Flutter (Channel stable, 2.10.5, on macOS 11.5.1 20G80 darwin-arm, locale en-ES)
• Flutter version 2.10.5 at /Users/timknogel/FlutterDev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (13 days ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/timknogel/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[!] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
✗ 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.
To re-install see https://guides.cocoapods.org/using/getting-started.html#installation for instructions.
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.66.2)
• VS Code at /Users/timknogel/Desktop/Visual Studio Code.app/Contents
• Flutter extension version 3.38.1
[✓] Connected device (1 available)
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127
[✓] HTTP Host Availability
• All required HTTP hosts are available
! Doctor found issues in 1 category.
which ruby
/usr/bin/ruby
My machine: MacBook Pro (13-inch, M1, 2020) Mac OS big sur
Update 4.0 I updated Mac to Mac OS Monterey to install Roseta 2.0 https://github.com/flutter/flutter/wiki/Developing-with-Flutter-on-Apple-Silicon
sudo softwareupdate --install-rosetta --agree-to-license
Then I tried again:
sudo gem uninstall CocoaPods
brew install cocoapods
brew link --overwrite cocoapods
Still same error.
brew unlink cocoapods
brew uninstall cocoapods`
sudo gem install CocoaPods`
Restarting IDE...
Same error.
Then I tried again with the standard ruby version and that failed again.
Flutter doctor
[✓] Flutter (Channel stable, 2.10.5, on macOS 11.5.1 20G80 darwin-arm, locale en-ES)
• Flutter version 2.10.5 at /Users/timknogel/FlutterDev/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 5464c5bac7 (11 days ago), 2022-04-18 09:55:37 -0700
• Engine revision 57d3bac3dd
• Dart version 2.16.2
• DevTools version 2.9.2
[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0)
• Android SDK at /Users/timknogel/Library/Android/sdk
• Platform android-31, build-tools 31.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• CocoaPods version 1.11.3
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2021.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7772763)
[✓] VS Code (version 1.66.2)
• VS Code at /Users/timknogel/Desktop/Visual Studio Code.app/Contents
• Flutter extension version 3.38.1
[✓] Connected device (2 available)
• iPhone 13 (mobile) • 3253AB15-FB90-45F5-93CD-5A95FC029075 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-2
(simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome 100.0.4896.127
! Error: Failed to prepare device for development. This operation can fail if the version of the OS on the device is incompatible
with the installed version of Xcode. You may also need to restart your mac and device in order to correctly detect compatibility.
(code 806)
[✓] HTTP Host Availability
• All required HTTP hosts are available
Flutter run -v result:
flutter run v.txt
Update 6.0 Git related?
Referring to this post:
https://github.com/CocoaPods/CocoaPods/issues/8661
I installed git with homebrew just in case CocoaPods don't work because of the git version.
Before:
git --version
git version 2.32.0 (Apple Git-132)
1.) Install git by home-brew
After:
brew install git
git --version
git version 2.36.0
2.) change Path variables to:
zshrc File:
export PATH=$PATH:/Users/timknogel/FlutterDev/flutter/bin
export JAVA_HOME=$(/usr/libexec/java_home)
export PATHTWO="/usr/local/opt/ruby/bin:$PATH"
export PATHTHREE=/usr/local/bin
The last one is supposed to point to the git version, but I am unsure if I did it the right way... I have no idea about this path variables...
when I write
git --version I get back:
git version 2.36.0
So the terminal can consult the gitversion. Why can flutter not? I don't understand much about the PATH (es). But I am not sure if it's really related anyways, because I don't have the GIT name issue that is mentioned in the post.
3.) I tried to downgrade Cocapods to 1.10.2 but it still doesn't work.
Can somebody please help me out?
This worked for me:
install the latest version of Ruby
Re-install CocoaPods
I was stuck with cocoapods problem while trying to install Flutter on my computer. Although I was constantly installing it, it was not seen by the flutter doctor. How can I solve this problem?
blackx#Black-Air ~ % sudo flutter doctor
Password:
Woah! You appear to be trying to run flutter as root.
We strongly recommend running the flutter tool without superuser privileges.
/
📎
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 1.22.5, on macOS 11.0.1 20B29 darwin-x64, locale tr-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
[!] Xcode - develop for iOS and macOS (Xcode 12.3)
✗ 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
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.52.1)
[!] Connected device
! No devices available
! Doctor found issues in 2 categories.
Had the same problem.
I just looked up my .bash_history and tried to remember, so I don't know if all below is relevant or in the right order or complete. So here are more or less random commands which might help you.
In the flutter/ios folder
rm Podfile.lock
pod repo update
Elsewhere
sudo chown $(whoami) /usr/local/Homebrew
sudo brew cleanup -d -v
gem pristine ffi --version 1.14.2
curl -L https://get.rvm.io | bash -s stable
rvm install ruby
xcode-select --install
sudo brew tap --repair
brew install cocoapods
brew link cocoapods
git -C /user/local/Homebrew/Library/Taps/homebrew/homebrew-core fetch --unshallow
If you do find out how to actually do it, please remember the order of your commands so you can post them here too :)
After downloading the hyperloop-examples files, and running appc ti build -p ios, I get errors when Hyperloop finds the CocoaPods dependencies.
The exact error text is:
[ERROR] An error occurred during build after 3s 372ms
[ERROR] pod install returned a non-zero exit code
The only change I had to make was to set sdk-version in tiapp.xml to 5.4.0.v20160608165242 instead of 5.4.0 (pulled this version of the SDK by running appc ti sdk install -b 5_4_X)
appc -v returns 5.2.2
appc ti -v returns 5.0.6
Also, if I remove the Podfile file, the app builds and runs on the simulator. Most of the samples work (obviously not the Third-Party Libraries one). I see in some of the other issues where people were able to get the cocoapod dependencies working, so this may just be a cocoapod issue with my machine.
pod --version returns 1.0.1
pod install provides the error:
Could not automatically select an Xcode project. Specify one in your Podfile like so:
Version 1.0.1 of cocoapods does not work with hyperloop right now. Uninstalled that version and installed 0.39.0 instead resolved the issue.
sudo gem install cocoapods -v 0.39.0
One way that worked for me:
Remove cocoapods
gem uninstall --all --executables cocoapods
Install it again
sudo gem install cocoapods
Make sure you're running latest node lts (4.5.0)
Re-open Appc Studio to see it works