Setup React Native CLI in Linux or macOS
Tags: reactnative, beginners
Published: 2022-11-01 17:45:38

<a name="top"></a>
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](#reference) but do take _EXTRA NOTE_ ⚠️ on the 👉 [Important](#important) 👈 mentioned below.

Sorry for those who using **Windows** 🙇, you may still need refer to the [Setting up the development environment](#reference) 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 <u>cross-platform</u> nature provided by **react-native**, please get a **macOS** since you can install both **Android Studio** and **Xcode**.

---
### <u>Important</u><a name="important"></a>: ⁉️
- 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](#reference)**, if you are using **Mac M1**, you might need to use
```
arch -x86_64 pod install
```
- But I recommend to use **brew** to install **Cocoapods**, because now you can use `pod install` as per mentioned in [Stack Overflow](#reference).
- Do take note that you need to reinstall **yarn** if you _CHANGE_ the **node** version via **nvm**.

[Go back to top ☝️](#top)

#### <u>Dependencies</u>:
1. [node](https://nodejs.org/en/) - recommend to install via nvm 👇
2. [nvm](https://github.com/nvm-sh/nvm#installing-and-updating) [☝️☝️](#important)
3. [npm](https://www.npmjs.com/) - packages manager
4. [yarn](https://yarnpkg.com/) - packages manager (optional)
5. [Homebrew](https://brew.sh/) (for macOS only)
6. ruby (for macOS only) - recommend to install via rbenv 👇
7. [rbenv](https://github.com/rbenv/rbenv#installation) (for macOS only) [☝️☝️](#important)


#### <u>IDE</u>:
1. [Visual Studio Code](https://code.visualstudio.com/) (because it is free)
2. [Android Studio](https://developer.android.com/studio)
3. [Xcode](https://developer.apple.com/xcode/) (for macOS only)
4. [WebStorm by JetBrains](https://www.jetbrains.com/webstorm/) (Optional)


#### <u>Steps</u>:
1. Install **node** via nvm.
2. Refer the steps in [Setting up the development environment](https://reactnative.dev/docs/environment-setup)
3. Install **watchman** via brew. (macOS only)

##### <u>Android</u>:
4. Install **JDK**.
5. Install **Android Studio**.
6. Install **Android SDK**.

##### <u>iOS</u>:
7. Install **ruby** via rbenv. (optional because macOS should have ruby installed.)
8. Install **Cocoapods** via brew.
9. Install **Xcode** & **Xcode Command Line Tool**.


#### <u>References:</u> <a name="reference"></a>
1. [Setting up the development environment](https://reactnative.dev/docs/environment-setup#development-os) 
2. [Cocoapods](https://reactnative.dev/docs/environment-setup#cocoapods)
3. [Stack Overflow: How to run CocoaPods on Apple Silicon (M1)](https://stackoverflow.com/questions/64901180/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)