Dhruv Parmar
Dhruv Parmar

Reputation: 45

Setting up the development environment for React Native in Apple M1

How to setup up the development environment for React Native in Apple M1 ARM-based system?

Upvotes: 0

Views: 3180

Answers (1)

Dhruv Parmar
Dhruv Parmar

Reputation: 45

RN Environment Set For Android & iOS :

  1. Install home-brew (https://brew.sh)

    • /bin/bash -c "$(curl -fsSL

https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

  1. Install node & watchman (from terminal)
    1. brew install node
    2. brew install watchman

Don’t use the wrong JDK for React Native if you’re using an M1 Mac …or you’ll be going 2x as slow and not know why

*Reference (https://shift.infinite.red/dont-use-the-wrong-jdk-for-react-native-if-you-re-using-an-m1-mac-252533dd47a2)

  1. Install SDKMAN (https://sdkman.io)

    curl -s "https://get.sdkman.io" | bash sdk list java (check the version you want to install) sdk install java 11.0.14-zulu

*Using of Sdkman (https://towardsdatascience.com/install-and-run-multiple-java-versions-on-linux-using-sdkman-858571bce6cf)

  1. Download and Install Android Studio

    1. Select AS for Mac (https://developer.android.com/studio/preview)
    2. Select the Mac with Apple chip
    3. Android Studio installs the latest Android SDK by default.
    4. Select latest Android SDK Command-line Tools (Preference > Android SDK > SDK Tools > show package details)
  2. Add the following lines to your in your ~/.zshrc :

    1. export ANDROID_HOME=$HOME/Library/Android/sdk
    2. export PATH=$PATH:$ANDROID_HOME/emulator
    3. export PATH=$PATH:$ANDROID_HOME/tools
    4. export PATH=$PATH:$ANDROID_HOME/tools/bin
    5. export PATH=$PATH:$ANDROID_HOME/platform-tools

    Note : To add this :

    1. Open terminal & type nano $HOME/.zshrc
    2. Copy that 5 lines and paste it
    3. Control + O and then press return (to save).
    4. Control + x (to exit)
  3. Create project :

    npx react-native init AwesomeProject

  4. Run project : npx react-native run-android - (to run in android)

Reaming Setup for iOS :

  1. Install Xcode from Appstore

  2. ruby -v (ruby is default installed)

  3. Open terminal and type :

  • sudo xcode-select -switch /Applications/Xcode.app/Contents/ Developer
  • sudo xcode-select --install
  1. brew install libffi

  2. brew install cocoapods

  3. Now to run iOS application

  • Simulator : npx react-native run-is
  • Device : npm install -g ios-deploy

    Run on a connected device, e.g. Max's iPhone:

    react-native run-ios --device "Max's iPhone"

Upvotes: 1

Related Questions