flutter cocoapods mac m1安装错误 - 扑面设置
我无法运行我的Mac M1计算机上具有可可录的Flutter应用程序。
扑朔迷离:
警告:可可蛋白录是安装但损坏的。跳过POD安装。 您似乎已安装了可可录,但行不通。 如果安装可可录的Ruby版本与用于调用它的版本不同。 这通常可以通过重新安装可可录来解决。 要重新安装请参见 https://guides.cocoapods.org/geting/getting/getting/getting/getting> -started.html#安装用于说明。 Ruby -V
Ruby 2.6.3p62(2019-04-16修订版67580)[Universal.ARM64E-DARWIN20]
更新:我用自家酿造的Ruby版本更新了Ruby版本,但仍然给出相同的错误:
< <代码> Ruby -V Ruby 3.1.2p20(2022-04-12修订版4491BB740A)[x86_64-darwin20]
更新2.0我尝试使用Homebrews
brew bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre bre nastim-构建源
然后:BREW链接-OverWrite Cocoapods
flutter Clean ...
重新启动Android Studio ...
和同样的错误!
更新3.0新红宝石3.1.2p20与ffi
brew unlink cocoapods
brew brew unstall cocoapods
try_ing try_ing edim.com/p-society/cocoapods-on-apple-silicon-m1-computers-86E05AA10D3E“ rel =“ nofollow noreferrer”> https://medium.com/p-society/cocoapiety/cocoapods-on-on-apple-silicon-silicon-m1 -Computers -86E05AA10D3E _
使用Rosetta
SUDO ARCH -X86_64 GEM INSTALS FFI
sudo gem instal cocoapods
- &gt;说没有安装可可录
,所以我尝试这种方法
: 代码> 1- Arch -X86_64 sudo Gem安装可可录-n/usr/local/bin/bin
2-拱门-x86_64 sudo gem install ffi 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>'
install 仍然没有解决方案...
最近的扑面医生:
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:
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:
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这最终对我在M1 Mac
BREW升级Ruby&amp; amp; Brew Link Ruby -force
brew Reinstall Cocoapods
rm Podfile.lock.lock
sudo Gem Update- -System 3.4.21
sudo gem install ffi
pod install
在ios目录中flutter run
This finally worked for me on M1 mac
brew upgrade ruby && brew link ruby --force
brew reinstall cocoapods
rm podfile.lock
sudo gem update --system 3.4.21
sudo gem install ffi
pod install
in ios directoryflutter run
这对我有用:
This worked for me: