Setting up macOS for react native projects
To run a react native app on actual device follow steps here: https://reactnative.dev/docs/running-on-device
Using Expo Go with actual devices
The fastest way to start development with React Native is using Expo Go
app on an actual iPhone or Android device. This way you don't need to install Xcode
or Android Studio
or simulators on your machine. Simply go to https://docs.expo.dev/get-started/introduction/ and follow the steps there.
Using React Native CLI without Expo
npx @react-native-community/cli@latest init AwesomeProject
cd AwesomeProject
npm start
Then press "a" to run app on Android emulator or on an Android device if you have it connected to your mac via USB. To verify if your connected android phone is recognized run this command in temrinal:
adb devices
Using Expo Go with simulators
Add steps here...
Using react native cli (without Expo Go)
To build iOS apps on macOS you need Xcode, Ruby, and CocoaPods. To install Xcode (comes with iOS Simulators) go to App Store and download and install latest version of Xcode on your Mac. If you have an older macOS, you may need an older version of Xcode as listed here: https://developer.apple.com/support/xcode/ For example on macOS Big Sur you will need to download and install version 13.2 of Xcode which you can download from: https://developer.apple.com/download/all/
Then run in terminal:
npx react-native@latest init AwesomeProject
To verify that you have all requirements installed run:
npx react-native doctor
To ensure you're using the most current version of the React Native CLI run:
npx react-native@latest
To find version of installed react native:
npm view react-native version
If build fails for iOS try:
cd ios
pod update