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
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
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
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
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
sudo gem uninstall cocoapods
rvm install 2.6.5
sudo gem install cocoapods
I am using MacBook Pro (2020) with M1 and following steps worked
url -L https://get.rvm.io | bash -s stable
rvm install ruby-2.6
rvm reinstall ruby-2.6.6
rvm use ruby-2.6.6
rvm --default use 2.6.6
sudo gem install cocoapods
Finally you can run flutter doctor to confirm.
flutter doctor
Output will be like this...
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.4, on macOS 12.4 21F79 darwin-arm, locale
en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version
32.0.0-rc1)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] VS Code (version 1.68.1)
[✓] Connected device (1 available)
[✓] HTTP Host Availability
Please install latest version of ruby to solve this issue.
Use this command
rvm install ruby
rvm use ruby
rvm --default use
sudo gem install -n /usr/local/bin cocoapods
Just run this command for installing the latest version of coc
This error took me about one week to solve :(
The problem is mentioned clearly in the flutter output like this
This can happen if the version of Ruby that CocoaPods was installed with is different from the one being used to invoke it.
I had a lot of versions of ruby installed on my mac So this error happened to solve this error follow these steps
remove or uninstall cocoapods
remove all versions of ruby in your mac os except the system ruby version you can do that like this.
https://mac.install.guide/ruby/9.html#:~:text=Uninstall%20Ruby%20on%20Mac%20with%20rbenv,command%20to%20remove%20a%20version.&text=This%20will%20remove%20any%20gems,recommendations%20of%20newer%20version%20managers.
install ruby again using this link https://mac.install.guide/ruby/13.html
install cocoapods with this command :- brew install cocoapods
Related
I install Homebrew.
Then I run command
"brew install cocoapods". It install successfully
but in flutter doctor i got error: cocoapods installed but not working properly. Error because of ruby incompatible version.
Tried another method
"sudo gem install cocoapods"
and got error:
While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0 directory.
This is m1 pro 2020 machine.
For MAC M1 chip Users try this solution
install ffi first (if not) In regular terminal using command: sudo arch -x86_64 gem install ffi then arch -x86_64 pod install --repo-update
Run flutter clean
Once complete, rebuild your Flutter application: flutter run
Try to avoid linking with system ruby and download a new ruby version using brew:
brew install ruby
Then add this line to .bash_profile or .zshrc
export PATH=/usr/local/opt/ruby/bin:$PATH
Close the terminal and open it again, then run this line to make sure the default ruby is the newly installed:
which ruby
Uninstall gem cocoapods and download it using brew
brew install cocoapods
I'm using VS Code to practice the Dart language (not flutter, I'm using Android Studio for that). My file's name is main.dart. Anyways, VS Code keeps telling me to upgrade Dart to the latest version.
Whenever I do, the command prompt/Powershell informs me that access to path 'dart.exe' is denied, specifically C:\tools\dart-sdk\bin\dart.exe.
How do I fix this?
You can upgrade dart SDK using flutter console:
1- Head to your flutter SDK folder path ( where you downloaded flutter SDK).
2- Open flutter console and type flutter upgrade --force.
This will upgrade both flutter and dart SDKs
you can upgrade dart sdk by using flowing command:
In Windows
choco upgrade dart-sdk
In Linux
If you’re using Debian/Ubuntu on AMD64 (64-bit Intel), you can choose one of the following options, both of which can update the SDK automatically when new versions are released.
Install using apt-get
Install a Debian package
Install using apt-get
Perform the following one-time setup:
sudo apt-get update
sudo apt-get install apt-transport-https
sudo sh -c 'wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
sudo sh -c 'wget -qO- https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
Then install the Dart SDK:
sudo apt-get update
sudo apt-get install dart
Install a Debian package
Alternatively, download Dart SDK as Debian package in the .deb package format.
Modify PATH for access to all Dart binaries
After installing the SDK, add its bin directory to your PATH. For example, use the following command to change PATH in your active terminal session:
export PATH="$PATH:/usr/lib/dart/bin"
To change the PATH for future terminal sessions, use a command like this:
echo 'export PATH="$PATH:/usr/lib/dart/bin"' >> ~/.profile
For more details visit this link:
https://dart.dev/get-dart
I have been trying to install cocoapods but I keep getting an error. I have tried the following commands and get the same result.
sudo gem install cocoapods
sudo gem install -n /usr/local/bin cocoapods
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf20200726-37338-rvqxhv.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h
You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.13.1 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.13.1/gem_make.out
After a lot of searching I finally came across a solution that I believe works. If you are use Mac OS Catalina you need to use Brew.
Open Terminal on your Mac.
Now, run
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
Install cocoapods using brew
brew install cocoapods
cocoapods is ready to use now!
This is the only install that fails, I have already installed Flutter on 2 other Macs without any issue.
It's a MBP 15-inch, 2018 running Mojave.
What might interfere with the installation is SentinelOne, that's installed on this machine and that I can't remove, so I need to somehow work around it.
Here's flutter doctor:
$ flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.5 18F203, locale en-BE)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
✗ Android license status unknown.
Try re-installing or updating your Android SDK Manager.
See https://developer.android.com/studio/#downloads or visit https://flutter.dev/setup/#android-setup for detailed instructions.
[!] iOS toolchain - develop for iOS devices (Xcode 10.2.1)
✗ libimobiledevice and ideviceinstaller are not installed. To install with Brew, run:
brew update
brew install --HEAD usbmuxd
brew link usbmuxd
brew install --HEAD libimobiledevice
brew install ideviceinstaller
✗ ios-deploy not installed. To install:
brew install ios-deploy
✗ CocoaPods not installed.
CocoaPods is used to retrieve the iOS platform side's plugin code that responds to your plugin usage on the Dart side.
Without resolving iOS dependencies with CocoaPods, plugins will not work on iOS.
For more info, see https://flutter.dev/platform-plugins
To install:
brew install cocoapods
pod setup
[!] Android Studio (version 3.4)
✗ Unable to find bundled Java version.
[✓] IntelliJ IDEA Ultimate Edition (version 2019.1.2)
[!] Connected device
! No devices available
! Doctor found issues in 4 categories.
I run brew update and then:
$ brew install --HEAD usbmuxd
==> Cloning https://git.sukimashita.com/libusbmuxd.git
Updating /Users/me/Library/Caches/Homebrew/usbmuxd--git
From https://git.sukimashita.com/libusbmuxd
60109fd..6539b02 master -> origin/master
==> Checking out branch master
Already on 'master'
Your branch is behind 'origin/master' by 4 commits, and can be fast-forwarded.
(use "git pull" to update your local branch)
HEAD is now at 6539b02 iproxy: Fix (newly introduced) timeout errors not being handled
==> ./autogen.sh
Last 15 lines from /Users/me/Library/Logs/Homebrew/usbmuxd/01.autogen.sh:
2019-07-04 13:22:50 +0200
./autogen.sh
./autogen.sh: line 6: libtoolize: command not found
./autogen.sh: line 8: aclocal: command not found
./autogen.sh: line 9: autoheader: command not found
./autogen.sh: line 10: automake: command not found
./autogen.sh: line 11: autoconf: command not found
./autogen.sh: line 14: ./configure: No such file or directory
Any help would be greatly appreciated.
I ran into the same issue few days ago.
First you have not completely installed all the requirements of Android studio and Xcode.These errors stamps from improper installation and configurations.
Follow these steps.
Install or reinstall Android Studio -for the latest version
Install or reinstall Flutter macOS
https://flutter.dev/docs/get-started/install/macos
Install or update Xcode - this takes nearly a couple of hours depending on your connections.
Once all is installed - you need to run the command Lines to accept the agreements for Xcode and Xcode toolbox.
Install cocoa pod also using the command Line as mentioned in the flutter guide.
Finally, make sure that your flutter path in located somewhere you can find it and create a .zshrc file and expose the path into this file. I recommend /Users/johndoe/Development
`nano ~/.zshrc'
export PATH="$PATH:[PATH_OF_FLUTTER_GIT_DIRECTORY]/bin"
per my recommendation it would look like this
export PATH="$PATH:/Users/johndoe/Development/flutter/bin"
you have to install brew for that, first of all you have to run this command and after that run all other command as suggested in flutter doctor result.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
download java from following link and install it.
https://support.apple.com/kb/dl1572?locale=en_US
Android studio 3.4 is not now supported with flutter, so as of now you can not solve this error.
for More details you can refer this video.
https://www.youtube.com/watch?v=Xy-qHlaHr6c
I am following the Get Started tutorial.
I can install everything, flutter doctor returns all checkmarks but in the end there is a message:
idevice_id returned an error:
ERROR: Could not connect to lockdownd, error code -2
Same message appears if I try to run the app using flutter run or if I try to list the devices using flutter devices.
The tutorial also states that:
Note: If the Run & Debug buttons are disabled, and no targets are listed, Flutter has not been able to discover any connected iOS or Android devices or simulators. You need to connect a device, or start a simulator, to proceed
I have two devices listed my Android phone and an iPhone simulator. Run and Debug buttons are ENABLED!
How can I run my app using flutter? It can be either using the command line or IntelliJ IDE.
Disconnect all iOS devices, then:
brew uninstall ideviceinstaller
brew uninstall libimobiledevice
brew install --HEAD libimobiledevice
brew link --overwrite libimobiledevice
brew install --HEAD ideviceinstaller
brew link --overwrite ideviceinstaller
sudo rm -rf /var/db/lockdown/*
Connect an iOS device, and choose "Trust" when prompted, after that:
sudo chmod -R 777 /var/db/lockdown/
This workaround worked for me when loosing the connection:
close everything (Visual Studio Code, Xcode, Simulator)
disconnect any physical device
Start Visual Studio Code
connect a physical IOS phone
Start XCode
build from XCode (it will work)
Disconnect your physical device
Start without debug
You will be prompted to connect to a device
and from there it worked again!
This just to help to debug the loos of connection bug. I have also observed that it begins just after the "stop debugging" command from Visual Studio Code.
I was having similar issues, and resolved them using the below. Hopefully this will help you. flutter doctor was telling me the answers, but they were a bit buried. Look for something like this:
[-] iOS toolchain - develop for iOS devices (Xcode 8.3.3)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 8.3.3, Build version 8E3004b
✗ libimobiledevice and ideviceinstaller are not installed or require updating. To update, run:
brew uninstall --ignore-dependencies libimobiledevice
brew install --HEAD libimobiledevice
brew install ideviceinstaller
• ios-deploy 1.9.1
✗ ios-deploy out of date (1.9.2 is required). To upgrade:
brew upgrade ios-deploy
• CocoaPods version 1.2.0
There are four brew commands in there to run. When I did them, this problem disappeared for me. Good luck!