How can solve this problem? Error: To set up CocoaPods for ARM macOS, run: arch -x86_64 sudo gem install ffi
Asked Answered
L

3

10

Updated context:

When I tried to run flutter project, but I got the this error Error: To set up CocoaPods for ARM macOS, run: arch -x86_64 sudo gem install ffi

I'd run arch -x86_64 sudo gem install ffi, but still had same issues.

this is information

yomate@Mac-mini yomate % sudo gem install ffi
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/rbconfig.rb:230: warning: Insecure world writable dir /Users/yomate/FlutterDev/flutter/bin in PATH, mode 040777
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Parsing documentation for ffi-1.15.5
Done installing documentation for ffi after 3 seconds
1 gem installed

How can solve this problem? arch: posix_spawnp: gem: Bad CPU type in executable , environment: Mini M1

When I want to use this commend

sudo arch -x86_64 gem install ffi and sudo arch -x86_64 gem install cocoapods

I had got this error. arch: posix_spawnp: gem: Bad CPU type in executable

And my flutter still had error.

[!] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale
    en-AU)
    ✗ Downloaded executables cannot execute on host.
      See https://github.com/flutter/flutter/issues/6207 for more information
Litmus answered 28/5, 2022 at 11:54 Comment(3)
I'm not sure if that's the fix but try uninstalling the ffi gem and installing it again, this time natively: sudo gem install --user-install ffi, then just flutter runUngraceful
Having the same error, and @Ungraceful suggestion didn't fix it. Any additional thoughts?Mustang
@Mustang make sure your binaries as well as env architectures are aligned, execute arch, flutter doctor and dart --version - they should all return darwin-arm or arm64Ungraceful
V
15

try with this
sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc
source

Vermeil answered 13/6, 2022 at 10:44 Comment(0)
H
1

just simple install cocoapods with brew brew install cocoapods

Halloween answered 27/7 at 19:18 Comment(0)
K
0

I was getting the same message on a fresh install of macOS 12.4 on a M1 MBA,

Downloaded executables cannot execute on host.
See https://github.com/flutter/flutter/issues/6207 for more information

Turns out Rosetta wasn't installed yet (I'm guessing the transition to Apple Silicon is almost complete then? haha), and once I installed it the warning went away.

Kroo answered 20/6, 2022 at 22:0 Comment(2)
What method did you use to install Rosetta?Alleviator
I don't remember either by installing an Intel architecture app or through the command line.Kroo

© 2022 - 2024 — McMap. All rights reserved.