Steps to run react native app on ios simulator (Ref Link for getting started with react-native: https://reactnative.dev/docs/environment-setup)
Step 1: Install Xcode from App store ( Installing Xcode will also install the iOS Simulator and all the necessary tools to build your iOS app.)
Step 2:Installing an iOS Simulator in Xcode To install a simulator, open Xcode > Preferences... and select the Components tab. Select a simulator with the corresponding version of iOS you wish to use.
Step 3: Run below commands in Terminal To install Home brew (Ref Link:https://phoenixnap.com/kb/install-homebrew-on-mac)
Install Xcode Command Line Tools
-
From the Finder, select Go and click Utilities to display all the utilities.
-
Locate and launch the Terminal app.
-
In the terminal, run the following command to install Xcode command line tools:
xcode-select --install 4. Click Install when prompted to proceed with the installation.
- The script displays the Xcode License Agreement. If you agree to the terms, click Agree and wait for the installation to finish.
Step 4: Install Homebrew
After installing Xcode command-line tools, follow the steps below to install Homebrew.
- Download the installation script by running below command in Terminal:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
-
Enter your administrator password when prompted and press Return to continue. Wait for the download to finish.
-
Press Return to install Homebrew. The installation may take a couple of minutes, so wait for the Installation successful message to appear.
-
Disable the analytic data collection by running: brew analytics off
Step 5:Run the following commands in a Terminal after installing Homebrew ( If node already installed on system note that Node version must be 14 or newer) brew install node brew install watchman
Step 6: Install CocoaPods by running below command sudo brew install cocoapods
Running your React Native application Step 1: Run npm install in Terminal in project folder path Step 2: Start Metro Bundler To start Metro, run below command inside your React Native project folder:
npx react-native start
Step 3: Start your application Let Metro Bundler run in its own terminal. Open a new terminal inside your React Native project folder. Run the following:
npx react-native run-ios
You should see your new app running in the iOS Simulator shortly.
Accessing the In-App Developer Menu: Press command key and D together in keyboard when your app is running in the iOS Simulator Or select iOS Simulator > Menu Bar > Device > Shake It will show action bar in simulator .Select start debugging
To do the wrapper module changes open ios->nativeModuleIOS.xcworkspace folder of react-native project in xcode editor After every changes in xcode , run npx react-native run-ios to run the app on simulator with the updated changes.