DEV Community

K.M WONG
K.M WONG

Posted on

Setup React Native CLI in Linux or macOS


Hi all 🙂, this post is for those who need help in setting up React Native CLI in Linux or macOS. Basically just to ensure you are following the steps in Setting up the development environment but do take EXTRA NOTE ⚠️ on the 👉 Important 👈 mentioned below.

Sorry for those who using Windows 🙇, you may still need refer to the Setting up the development environment and let the Chocolatey to settle for you.

I use Windows entertainment purpose only. 🎉

Side Note:
  • Linux or Windows only support Android since you can only install Android Studio.

  • If you want to experience the cross-platform nature provided by react-native, please get a macOS since you can install both Android Studio and Xcode.


Important: ⁉️

  • For node, I recommend to use nvm to install instead of using Homebrew for macOS.
  • Same for ruby, you may use rbenv to install.
  • For Cocoapods, if you are using Mac M1, you might need to use
arch -x86_64 pod install
Enter fullscreen mode Exit fullscreen mode
  • But I recommend to use brew to install Cocoapods, because now you can use pod install as per mentioned in Stack Overflow.
  • Do take note that you need to reinstall yarn if you CHANGE the node version via nvm.

Go back to top ☝️

Dependencies:

  1. node - recommend to install via nvm 👇
  2. nvm ☝️☝️
  3. npm - packages manager
  4. yarn - packages manager (optional)
  5. Homebrew (for macOS only)
  6. ruby (for macOS only) - recommend to install via rbenv 👇
  7. rbenv (for macOS only) ☝️☝️

IDE:

  1. Visual Studio Code (because it is free)
  2. Android Studio
  3. Xcode (for macOS only)
  4. WebStorm by JetBrains (Optional)

Steps:

  1. Install node via nvm.
  2. Refer the steps in Setting up the development environment
  3. Install watchman via brew. (macOS only)
Android:
  1. Install JDK.
  2. Install Android Studio.
  3. Install Android SDK.
iOS:
  1. Install ruby via rbenv. (optional because macOS should have ruby installed.)
  2. Install Cocoapods via brew.
  3. Install Xcode & Xcode Command Line Tool.

References:

  1. Setting up the development environment
  2. Cocoapods
  3. Stack Overflow: How to run CocoaPods on Apple Silicon (M1)

This is just my experience on settings up React Native CLI, and I am welcome and open to any feedback. Thank you. 🙇

Good luck and Happy coding! 🎉🎊🎇

Go back to top ☝️

Top comments (0)