How to install Expo CLI on MacOS

Ina HranovaIna Hranova 2 minutes 496 views

Share:

Expo CLI  is the successor to create React Native App. It allows you to build  Android and iOS apps with no build configuration. This means that developers can build native iOS applications without even owning a Mac computer. Typically, setting up a project is easy and can be done in minutes in the best case. Let’s start to install Expo.

1. Installing Expo CLI

Let’s install Expo CLI globally, you can do this by running the following command.

npm install -g expo-cli
//or 
yarn add global expo-cli

2. Initiate the project

First, create my-app using this command in the terminal:

expo init my-app

Then go to the directory with the following command in the terminal:

cd my-app

3.Finally, run the project

expo start
//or
yarn start

Then it’ll show the result:

Terminal Expo CLi

Also, it’ll open Expo Developer Tools, a browser-based graphical UI for quickly setting up your testing devices and emulators for Expo development, streaming device, and bundler logs and deploying updates.

Metro Builder for Expo Cli

4.Viewing a Project on Your Phone or Simulator

The server will continue running until you close it. To develop and preview apps with Expo, we need to install its Expo app on your Android or iOS device. It’s available on the Google Play Store and on the iOS App Store.

Expo Application on IOS

Open the app Expo and you’re available to test your app. For the app to load on your physical device, you’ll need to make sure that your phone is connected to the same local network as your computer.

install Expo Start on IOS

5. Move to React Native

However, you can eject your project to plain React Native. From your project directory, just run the following the command :

expo eject

This will download the required dependencies and build native projects under the ios and android files.

6.Publishing a Project

To publish something you’ve made, just follow these steps:

1. Create an Expo account or login to an existing one by running the following command:

expo login

2. Run an Expo CLI server using the command:

expo start

3. Check to make sure you can load your app by opening it in the Expo app.

4. Once everything looks good, run  the following command:

expo publish

A few seconds later, you should get a clean URL sent to you that points to the exp.host server where your package was published to.

That’s it! You’ve successfully run your first Expo app. Happy coding.