Posts Learn Components Snippets Categories Tags Tools About
/

React Native macOS Installation Guides 2023

Get to know how to setup React Native macOS Installation Guides 2023 for easy development

Created on Jan 27, 2023

698 views

Follow the steps below for a fresh setup and installation on macOS 2023

1 - Install Xcode from App Store


First, you have to install Xcode from the Apple App Store.

2 - Install Xcode Select
Once you have Xcode installed you need to install Xcode Select (a command line tool for macOS)

xcode-select --install

3 - Install OpenJDK 8 or 11 (temurin)


Now you will need to download and install OpenJDK 8 which is an open-source implementation of Java. For Version 11 you can download using the following link: OpenJDK 11 (x64).

3.5 - Additional Setup: jenv


You might also want jenv to easily switch with other Java versions.
brew install jenv
Then export the path and configs.
# Shell: bash
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(jenv init -)"' >> ~/.bash_profile

# Shell: zsh
echo 'export PATH="$HOME/.jenv/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(jenv init -)"' >> ~/.zshrc
To link and set the OpenJDK, run the following command.
jenv add /Library/Java/JavaVirtualMachines/temurin-11.jdk/Contents/Home

jenv versions

jenv global temurin64-11.0.18

jenv local temurin64-11.0.18

jenv shell temurin64-11.0.18

4 - Install NVM (Node v16 recommended)


We recommend Node v 16. If you don't have it installed, make sure to use NVM to easily install and switch between different versions.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
nvm install 16
nvm alias default v16.19.0
nvm use default

5 - Install Homebrew and the following dependencies


In addition to that, you also need to have watchman which is a watcher to detect when you made a code update and then automatically build and push the update to your device.
brew install watchman

6 - Install Ruby (v2.7.7)


By default macOS comes with old ruby version so we recommend to get a slightly updated on (v 2.7.7)
brew install rbenv ruby-build

rbenv init

rbenv install 2.7.7

rbenv local 2.7.7 && rbenv global 2.7.7

7 - Install Cocoapods (v1.11.2)


Cocoapods is also required to build IOS project and you have 2 options to install it, 1 is using brew and 2 is using gem. We recommend that you use gem with specific version Cocoapods 1.11.2
gem install cocoapods -v 1.11.2

8 - Clone Repo / Init Project


By now you should be ready to clone your react native repo / init a new project
git clone xxx

# or

npx create-expo-app my-app

9 - Install Dependencies


Once you have your project you need to install it, and put "--force" flag to force install all dependencies.
npm i --force

10 - Prebuilt the project (Native)


In addition to the previous step, you need to prebuild the project since Expo no longer uses eject.
npx expo prebuild

11 - Run Project


Run the command below to start and run the Expo project in IOS Emulator
npm run start

npm run ios

12 - Expo Build APK with EAS


To build the APK locally with expo EAS you can run the command below.
eas build -p android --local --profile preview

If you want to use EAS Server / Service you can remove the '--local' flag.
eas build -p android --profile preview

Do make sure you have the eas.json before running the command above.

Conclusion


I hope this helps for your new React Native installation in 2023, if it does help then make sure to share it with others, and cheers! Happy coding.

If you do have issues / questions let's start the discussion in the comment down below

If you like our tutorial, do make sure to support us by being our Patreon or buy us some coffee ☕️

Load comments for React Native macOS Installation Guides 2023

)