4

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 for RCT-Folly from ../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec Fetching podspec for glog 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???

5
  • Try disable flipper. Remove use_flipper!() in ios/Podfile. After that run pod install in ios folder your project. Commented Jun 19, 2021 at 8:47
  • are you trying to run any template project ? Commented Jun 19, 2021 at 8:49
  • @PavanTank I am just trying to set up Xcode etc. to write React Native for iOS. And I bumped into this error before I am even able to initialise my first test app. Commented Jun 19, 2021 at 8:53
  • @PavanTank but I have tried React Native with Android Studio on my Windows desktop before though. Commented Jun 19, 2021 at 8:54
  • @VasylNahuliak Hi! Just tried, still the same Ruby bug... Commented Jun 19, 2021 at 8:56

4 Answers 4

13

https://github.com/CocoaPods/CocoaPods/issues/10349#issuecomment-849468291

brew install cocoapods
sudo arch -x86_64 gem install ffi
arch -x86_64 pod install
Sign up to request clarification or add additional context in comments.

8 Comments

I am not sure if its a new problem, or problem not solved. After I tried your three commands, I can run the init command without problems it seems. however, as I cd into the directory and run "npx react-native start" as in the React Native website, the terminal just gives no output and I was prompt to choose to reload the app or to open developer menu. whichever option I choose, I will be greeted with "No apps connected". why is that??
I guess you need create a new question with details steps. Thank you
created the new question... should I just reinstall Xcode or something as what I have been doing seems to create more problems than it solved... Pandora's box...
I'm on an m1 macbook for development and the key to solving this for myself was the brew command to install cocoapods. What I believe happened was it updated the current version I had. Then running "arch -x86_64 pod install". I had tried this so many different ways, but this was the solution that finally worked for me.
Ditto here - running just brew install cocoapods was sufficient on a new M1 Max MBP - it updated both ruby and cocoapods with specifically arm64 & monterey versions
|
1

In my case, need to restart my terminal before execute pod install. Monterey + M1.

Comments

0

The top answer doesn't work for me on my MBP M1 so I fixed the issue this way :

  1. Make sure you have opened project.xcworkspace and not the project.xcodeproj

  2. Open the workspace file with xcode with clicking on it then go to File -> Workspace Settings ... -> Build System -> Legacy Build System

  3. Select the project file then the Target then go to Build Settings Tab and Search Paths

enter image description here

  1. Double click on Library Search Paths Debug and move the $(inherited) to the bottom of the list

enter image description here

  1. Do the same for the Release .

enter image description here

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

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.