M1 Apple Silicon and React-Native IOS Build Problems [ENG]

Ayberk Gerey
3 min readApr 17, 2021

Hello Everyone!

In this article, I will tell you how to fix some React-Native IOS Build problems came up with M1 chip even if you have done environment setup perfect.

React/RCTBridgeModule.h file not found, Podfile.lock can’t found, few Build failures and Xcode build failed are our errors.

Before We Start!

  • Before we start to write commands you have to check every requirement on the Environment Setup page of React-Native. Also don’t forget to install Cocoapods and Xcode on your device!
  • The lockfile error occurs because the Yarn is installed. Therefore we will continue with npm, We will not install the Yarn

Things we will do :

  • Your device with M1 processor doesn’t build a lot of pod files and Podfile.lock when you created a react native project. Paste this command to fix this problem.

-sudo arch -x86_64 gem install ffi

If you created a React-Native project before that; open your ios directory and use this command for updating your project: arch -x86_64 pod install but Xcode won’t build it anyway…

- cd ios && arch -x86_64 pod install

Xcode Part

  • Now we open the file ends with .xcworkspace which is inside of the ios directory.

2. In Xcode we create a Swift file. You can leave the file name as “file ”and click Create Bridging Header .

3. We open Build Settings and writing arm64 to opposite of Debug and Release under the Excluded Architectures.

4. Then we change Podfile inside of the ios directory.

The part We will add:

installer.pods_project.build_configurations.each do |config|
config.build_settings[“EXCLUDED_ARCHS[sdk=iphonesimulator*]”] = “arm64”
end

5. Then we return to ios folder and writing pod install command.

6.We click Clean Build Folder from Xcode which is under the Product tab.

I hope it will be useful for you, Happy Coding!

--

--