Reputation: 183
I am very new to Apple and app programming so please forgive me if I am not asking my questions in the perfect "format" that you might be expecting...
I bought my MacBook Air running on M1 chip just few days ago and would like to program with Xcode and React Native. As I do the common command "npx react-native init AwesomeProject" I got into the error which I saw quite some other people also run into:
error Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
I tried all of the suggestions available on other posts (assuming I am understanding the remedies correctly and making the changes accordingly) but none seem to work for me.
I tried also the default suggested solution which is:
Please try again manually: "cd ./AwesomeProject/ios && pod install".
And I seem to get something different from others, which is:
Analyzing dependencies Fetching podspec for
DoubleConversion
from../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec
Fetching podspec forRCT-Folly
from../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec
Fetching podspec forglog
from../node_modules/react-native/third-party-podspecs/glog.podspec
/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.1/lib/ffi/library.rb:275: [BUG] Bus Error at 0x0000000102a08000 ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.arm64e-darwin20]
and then
You may have encountered a bug in the Ruby interpreter or extension libraries.
Is it something to do with my Ruby interpreter? If yes, what are the commands I could use to solve the issue???
Upvotes: 4
Views: 4498
Reputation: 512
In my case, need to restart my terminal before execute pod install. Monterey + M1.
Upvotes: 1
Reputation: 1
If you are facing this issue in Mac Big Sur, reinstalling CommandLineTools can fix this issue.
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
Upvotes: 0
Reputation: 3814
The top answer doesn't work for me on my MBP M1 so I fixed the issue this way :
Make sure you have opened project.xcworkspace and not the project.xcodeproj
Open the workspace file with xcode with clicking on it then go to File -> Workspace Settings ... -> Build System -> Legacy Build System
Select the project file then the Target then go to Build Settings Tab and Search Paths
Then Build Again and you're good to go .
If you still get any errors run these commands in the ios folder of the react native project and do the above steps again and it will build successfully.
rm -rf ~/Library/Developer/Xcode/DerivedData/
pod deintegrate
pod install
Upvotes: 0
Reputation: 2468
https://github.com/CocoaPods/CocoaPods/issues/10349#issuecomment-849468291
brew install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
Upvotes: 13