How to Set Up React Native on M1 Mac 2022 Edition | by David Fekke | Apr, 2022

The documentation for React Native doesn’t comprise M1 Apple Silicon specifics

Graphic by David Fekke

I lately bought an M1 Mac for improvement. It’s my first time utilizing an M1 Mac, so I assumed to share my experiences.

Going by way of the React-Native documentation, I discovered quite a lot of it to be outdated. Here’s what I needed to do to get React-Native operating on my new Mac.

Make certain to put in the most recent model of Xcode onto your Mac. This may be put in by going to the App Retailer in your Mac, and trying to find Xcode, then putting in.

If you open Xcode, you need to be prompted to put in the Xcode command line instruments. To confirm that you’ve put in the instruments, go to the preferences, select places, and be sure you have the present model of the instruments put in. It ought to look one thing like the next;

Homebrew is like apt-get if Apple had a bundle supervisor. You may set up Homebrew by operating the next command in your terminal;

> /bin/bash -c "$( curl -fsSL up/HEAD/set "

This would possibly take a short time to put in, be affected person.

Subsequent it would be best to set up the LTS model of Node.js. I like to recommend utilizing the installer from their web site, however you can too set up utilizing Homebrew.

Use Homebrew to put in watchman. Run the next command in your terminal to put in watchman;

> brew set up watchman

Set up Cocoapods utilizing homebrew, don’t use the Ruby gem command listed within the documentation. Cocoapods is like NPM for Node. It’s used for putting in dependencies to your challenge. You can’t use React Native on iOS with a working putting in of Cocoapods.

> brew set up cocoapods

Upon getting the entire conditions put in, you’ll be able to run the next instance from their documentation

> npx react-native init AwesomeProject

After putting in the instance challenge, you’ll be able to run it by utilizing the next command;

> npx react-native run-ios

Not the entire kinks of growing on the Apple Silicon Macs have been labored out but, however with just some small adjustments you may get React-Native operating in your M1 Mac.

More Posts