Get Started
This guide will help you get started on setting up your very first React Native for macOS app.
** Please check either NPM or our GitHub releases to see our latest release**
For information around how to set up:
- React Native for iOS and Android: See React Native Getting Started Guide
- React Native for Windows: See React Native for Windows Getting Started Guide
Install React Native for macOS
Remember to call @react-native-community/cli init from the place you want your project directory to live. Be sure to use the same minor version between React Native and React Native macOS. We'll use ^0.79.0
npx @react-native-community/cli init <projectName> --version 0.79
Navigate into this newly created directory
Once your project has been initialized, React Native will have created a new sub directory where all your generated files live.
cd <projectName>
Install the macOS extension
Install the React Native for macOS packages.
npx react-native-macos-init
Running a React Native macOS App
Quick Start
In your React Native macOS project directory, run:
npx react-native run-macos
This will build your app and launch it automatically. A Metro bundler window will also open to serve your JavaScript code.
Alternative Methods
- Using Xcode: Open
macos/{YourProject}.xcworkspacein Xcode or runxed -b macos, then hit the Run button. - Build only: Use
npx react-native build-macosto build without launching.
The first run may take a while since it involves building the entire project and all dependencies. Subsequent runs will be much faster!
For more detailed information about CLI commands and build options, see the CLI Commands.
Happy coding! 🎉