For iOS the easiest way to install Xcode is via the Mac App Store. And for android download and install Android Studio. If you plan to make changes in Java code, we recommend Gradle Daemon which speeds up the build. Testing your React Native Installation. Use the React Native command line tools to generate a new React Native project called. Create the folder inside say your Documents folder on your Mac as below: mkdir Apps. Open VS Code and open New Terminal and type the following command to create a new React-Native App: react-native init MyApp cd MyApp cd ios pod install. Come back to the MyApp folder and run the below command to run your App in the iOS simulator: react-native. Aug 09, 2018 This is only for Mac. If you aren't using Mac for React Native dev - do it, it's pretty great. Setting up a react native environment Steps Software installs and file setup Install Xcode from the app store - Xcode is a program that runs iOS apps for you, and lets you start a simulator for your app so you can develop without needing a physical.
Contents
Outline
let’s see how to install and configure react-native development environment on Mac. If you want to know how to install react-native on Windows, see the blog post below.
you can use
Expo CLI and React Native CLI to develop react-native app on Mac.
Expo CLI is the package includes many native features(geolocation, camera, etc) when you develop the app with react-native. At the first time, when you develop the react native with Expo CLI, you can feel easy and comfortable. However, this pacakge includes many native features those you don’t use, and that makes the app build size bigger. Also, if you want to integrate the native feature which Expo CLI doesn’t include, it’s hard to make it. Therefore, this blog post doesn’t recommend to use Expo CLI.
This blog post is about how to install and configure React Native CLI environment. Also, we’ll create react-native project by React Native CLI and check it works well.
We need to install Nodejs, Watchman, Xcode, etc to develop the app by react-native. let’s see how to install them one by one.
Homebrew
Homebrew is a package manager on Mac to install and manage packages. We can install packages simply on Mac via Homebrew.
First, execute the command below to check Homebrew is installed on Mac.
If Homebrew is installed, you can see Homebrew version like below.
If Homebrew version is not shown, you can install Homebrew via the command below.
After installing, execute the command below to check Homebrew is installed well.
If Homebrew is installed well, you can see Homebrew version like below.
Nodejs
react-native is Javascript, so we need to install Nodejs that is Javascript runtime.
execute Homebrew command below to install Nodejs.
After installing, execute the command below to check Nodejs is installed well.
If Nodejs is installed well, you can see Nodejs version on the screen.
When Nodejs is installed, basically, npm (Node Package Manager) is also installed. Execute the command below to check npm is installed well.
If npm is installed well, you can see npm version like below.
Watchman
Watchman is to watch specific folders or files, and if they is changed, Watchman can trigger some actions. In react-native, Watchman watches the source codes and if they are added or changed, Watchman rebuilds them.
Execute Homebrew command below to install Watchman.
After installing, execute the command below to check Watchman is installed well.
If Watchman is installed well, Watchman version would be shown up.
React Native CLI
Let’s install React Native CLI to develop the app by react-native. Execute npm command below to install React Native CLI globally.
After installing, execute the command below to check React Native CLI is installed well.
If React Native CLI is installed well, you can see React Native CLI version like below.
Xcode
We need Xcode to develop iOS app by react-native. Click the link below to install Xcode via App store.
After Xcode is installed, we need to configure Command Line Tools. Execute Xcode and click
Xcode > Preferences.. > Locations on the top menu. When you click it, you can see Command Line Tools setting like below.
If the setting is not like above, click the dropdown menu and select last version of Command Line Tool.
Install Cocoapods
Cocoapods is the dependency manager on iOS development.
Cocoapods is necessary to develop an app by react-native. Execute the command below to install Cocoapods.
After installing, execute the command below to check Cocoapods is installed well.
If Cocoapods is installed well, you can see Cocoapods version like below.
JDK
We need to install JDK(Java Development Kit) to develop Android app with react-native. Execute the command below to install JDK.
After installing, Execute the command below to check Java is installed well.
If Java is installed well via installing JDK, you can see Java version like below.
When JDK is installed, Java compiler is alo installed. Execute the command below to check Java compiler is also installed well.
If Java compiler is installed well via installing JDK, Java compiler version is shown up like below.
How To Install React NativeAndroid Studio
We need to install Android Studio to develop Android app with react-native. Click the link below to go to Android Studio site and download the installation file.
After downloading, execute the installation file to execute Android Studio.
Android Studio Configuration
you can see the screen like below after executing Android Studio.
Click Next button to go to next screen. When you go to the next screen, you can see Install Type configuration screen. Select Custom option and click next button to go to next screen.
When you go to the next screen, you can see Select UI Theme screen like below. Select the theme which you like, and click Next button to go to the next screen.
When you go to the next screen, you can see SDK Components Setup screen like below. Select
Performance (Intel ® HAXM) option and Android Virtual Device option, and clic Next button.
on the next screen, you can see Emulator Settings screen like below. Click Next button without any changing especially.
the next process is just normal program installation, so I don’t explain the detail. Just click Finish button to continue Android studio installation to complete it.
After Android studio installation, you can see Android studio is executed like below.
Android Studio SDK Configuration
Click
Configure > SDK Manger menu on the right botton to go to Android SDK configuration.
When the screen is shown up like below, select
Show Pacakge Details option on the right bottom. find and select the options below on the list.
If you select all options above, click OK button on the right bottom to install them.
Configure Android Studio Environment Variable
Android studio installation and configuration are done. Now, we need to set the environment variables. open
~/.bash_profile file or ~/.zshrc file and add the code below to them to add the environment variables.
How To Install React Native App On Mac High Sierra
If you use
.bash_profile , execute the command below.
on the code above, you should modify Android SDK directory location to your location. If you don’t know where your Android SDK location, go to the Android Studio SDK configuration. https://gpotaq.weebly.com/blog/mac-app-store-mactracker.
you can find your Android SDK directory location at Android SDK Location section on the top of the Android studio SDK configuration screen. 32-bit x64.
Install React Native On Mac
After configuration, re-start the terminal and execute the command below.
If the environment variables are configured well, you can see the result like below.
Create & Check react-native Project
Sometimes, the react-native app is not working or can’t be built after updating the version. Therefore, it’s recommended to execute the npm command below to lock the version when you develop the app with react-native.
execute React Native CLI command below to create react-native project.
Check on iOS
After creating, execute the command below to execute the react-native app on iOS.
If you can’t execute well, execute
ios/SampleApp.xcworkspace file and select the simulator on the top of Xcode screen, and click the arrow button to execute the simulator.
Full contact mac app. If the react-native app is executed well, you can see the screen like below.
Check on Android
In Android, execute the command below after connecting the device that the developer mode is activated via USB or executing Android studio emulator.
If you don’t have any problen, you can see the screen like below.
Completed
We’ve seen how to install and configure react-native to develop the app on Mac. Also, We’ve created the app by React Native CLI and executed it to check the environment is configured well.
Now, we are ready to develop the app with react-native. Let’s dive to the react-native development world!
Github Sponsor
Was my blog helpful? Please leave a comment at the bottom. it will be a great help to me!
I’m interested in trying React native instead of Ionic for Dogwalk. And when doing this i’ll be writing the steps I take if someone else is interested in learning this as well. Now we’ll take a look on how to install React Native.
For React Native we need node, Watchman, React Native CLI and Xcode. Watchman is a service for watching changes in files and trigger actions when that happens. Reactive CLI is the command interface for React Native. Xcode is Apples IDE.
1. Install node and Watchman
Install node and watchman with Homebrew
2. Install React Native CLI
And then install React Native CLI with npm
3. Install Xcode and the Xcode Command line tools
Install Xcode from the Mac app store.
Install React Native On Windows
Then open the preferences of Xcode and install Command line tools.
Command line tools - Image borrowed from React native
4. Creating a React Native projectHow To Install React Native App On Mac Catalina
Run these commands in a terminal:
And we’ll end up with a screen like this:
React Native For MacReact Native documentation
To continue to explore React Native take a look at the Learn the basics in the documentation.
How To Install React Native App On MacbookI hope you find this post valuable. If you click the ad below I get paid by someone else and can continue to publish posts for free. I would appreciate it very much.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |