Skip to content
Documentation
Esc
↑↓navigate↵open⌘Jpreview
On this page

Build Expo apps for iOS and Android without a Mac

Build an Expo app for iOS and Android without EAS Build, run it on cloud devices, and develop against a Metro server on your machine.

Run lim xcode build or lim gradle build in your Expo project, and a cloud sandbox turns it into an iOS app or an Android APK. You don’t need a Mac or Xcode on your machine, and Android builds need no local Android SDK. The build installs and launches on a Limrun iOS simulator or Android emulator, and a Debug build can load its JavaScript from Metro on your machine.

This page uses the lim CLI. In the TypeScript SDK, the same Expo options go in reactNative on xcodebuild and gradlebuild, as the monorepo example shows.

Before you start

Install the CLI and export an API key from console.limrun.com/settings (API Keys, then Create Token):

npm install --global lim
export LIM_API_KEY=lim_...

Limrun treats a directory as an Expo app when its package.json lists expo in dependencies or devDependencies and an app.json, app.config.js, or app.config.ts sits next to it. Commit one lockfile, or set packageManager in the root package.json, so the sandbox installs with the same package manager you use.

What the sandbox does with your project

Each build syncs the project, skipping paths your .gitignore files exclude, and prepares it the way you would on your own machine:

  1. Finds the app. It looks at the repository root, in the packages that pnpm-workspace.yaml or the workspaces field of package.json declares, and otherwise up to two directories down.
  2. Installs packages with npm, pnpm, Yarn, or Bun, whichever the packageManager field or the lockfile names. An app at the root with neither uses npm. A reused sandbox skips the install while the package manifests and the lockfile are unchanged.
  3. Runs expo prebuild --no-install for the target platform when the app has no ios/ or android/ directory. A gitignored native directory never syncs, so the sandbox generates its own. On a reused sandbox, prebuild runs again only when app.json, app.config.js, app.config.ts, or the app’s package.json changes.
  4. Builds. On iOS, it runs CocoaPods, then xcodebuild with the workspace and scheme it finds in ios/. On Android, it runs the Gradle wrapper in android/.

If you commit the native project itself, an .xcodeproj under ios/ or a settings.gradle under android/, the sandbox builds it as is and skips prebuild, unless you pass --expo-force-prebuild. If synced files under ios/ have no .xcodeproj, such as a committed Podfile next to a gitignored project, prebuild still runs.

Limrun does not read eas.json. Pass the environment variables a build profile would set with --env KEY=VALUE; on iOS they reach the package install, expo prebuild, pod install, and xcodebuild. To pick Node, Ruby, or package manager versions, see Xcode and tool versions and Select tools.

Build and run on iOS

Build from the project root with --ios:

lim xcode build . --ios

--ios builds for the simulator on an Xcode sandbox with an attached iOS simulator, and creates both if needed. When the build succeeds, the app installs and launches on the simulator, and the CLI prints a signed stream URL for watching it. Every later build on the same sandbox installs the same way.

Without --configuration, an Expo build uses Release, so the JavaScript bundle ships inside the app and the app runs without Metro. To keep the build and install it on other simulators, add --upload <asset-name>; Upload the build artifact covers the rest.

Build and run on Android

Build a release APK, create an emulator, and attach the emulator to the Gradle sandbox:

lim gradle build . --task assembleRelease
lim android create
lim gradle attach-emulator <android-instance-id>

The first command creates the Gradle sandbox. lim android create prints the emulator’s instance ID. The attach installs and launches the latest APK, and every later successful build on that sandbox installs and relaunches the same way.

Without --task, lim gradle build runs assembleDebug, which produces the Debug app for developing against Metro. When the sandbox generates android/, a debug task builds only x86_64, the ABI Limrun emulators run, while release and bundle tasks keep the project’s own ABI list. Pass --abi to choose ABIs yourself.

Develop against Metro

A Debug development build loads JavaScript from Metro on your machine, so JavaScript edits reach the app without another build. Rebuild only after a native change, such as a new native dependency or an app config edit. Development builds need the expo-dev-client package; add it if the app does not have it yet:

npx expo install expo-dev-client

The steps below open the app through its development client URL, <scheme>://expo-development-client/?url=<encoded Metro URL>. <scheme> is the scheme from your app config, or exp+<slug> when there is none.

  1. Create a simulator with an attached Xcode sandbox. The command prints both instance IDs:

    lim ios create --xcode
  2. Route the simulator’s localhost:8081 to your machine, then start Metro in a second terminal and keep it running:

    lim ios tunnel --selector localhost:8081 --detach --id <ios-instance-id>
    
    EXPO_PACKAGER_PROXY_URL=http://localhost:8081 \
      npx expo start --dev-client --port 8081

    EXPO_PACKAGER_PROXY_URL makes Expo advertise localhost:8081 in the manifest and bundle URLs, which the tunnel carries.

  3. In another terminal, build a Debug app that opens Metro on launch:

    lim xcode build . --id <xcode-instance-id> \
      --configuration Debug \
      --dev-server-url "<scheme>://expo-development-client/?url=http%3A%2F%2Flocalhost%3A8081"

--dev-server-url requires --configuration Debug, a simulator build, and an attached simulator. Each install relaunches the app with that URL, so a native rebuild lands back on Metro. To open the URL yourself instead, use lim ios open-url as shown in Connect Expo and Metro.

  1. Build the Debug app, create an emulator, and attach it. This tab uses adb from the Android platform tools on your machine:

    lim gradle build .
    lim android create
    lim gradle attach-emulator <android-instance-id>

    lim android create also opens an ADB tunnel in the background, so the emulator shows up in adb devices as 127.0.0.1:<port>.

  2. Forward the emulator’s port 8081 to your machine and start Metro:

    adb -s 127.0.0.1:<port> reverse tcp:8081 tcp:8081
    npx expo start --dev-client --port 8081
  3. In another terminal, open the app on Metro:

    lim android open-url --id <android-instance-id> \
      "<scheme>://expo-development-client/?url=http%3A%2F%2F127.0.0.1%3A8081"

A restarted ADB tunnel gets a new port. Run adb reverse again with the serial that lim android connect --id <android-instance-id> prints.

Build an app inside a monorepo

Sync the repository root, where the lockfile is, so the install sees the whole workspace. A single Expo app in a declared workspace is found on its own. When the repository holds several Expo apps, the sandbox cannot pick one, so name the app directory relative to the root:

lim xcode build . --ios --expo-app-dir apps/mobile
lim gradle build . --expo-app-dir apps/mobile
xcode.xcodebuild({}, { reactNative: { expoAppDir: 'apps/mobile' } });
gradle.gradlebuild({ reactNative: { expoAppDir: 'apps/mobile' } });

An app below the root gets its package manager from the root, so commit the lockfile there or set packageManager in the root package.json.

Control prebuild

These flags change how prebuild runs. Each one makes the build require a detected Expo app:

  • --expo-force-prebuild (iOS only) runs prebuild even when ios/ exists. Use it when app.config.js reads other files or environment variables, because the sandbox does not watch those for changes, or when a build error suggests it.
  • --expo-no-clean passes --no-clean to prebuild, which updates the existing native directory instead of deleting it first. It does not make prebuild run.

The Xcode flag reference and React Native and Expo projects list every build flag.

Ship to the stores

Sign a device build and upload it to TestFlight with Sign and distribute. With --auto-build-number and your own certificate, the sandbox writes the next build number to ios.buildNumber in its copy of app.json before prebuild. An app configured only through app.config.js has no app.json to update; cloud signing sets the number on the archive instead.

On Android, Sign and publish signs an AAB and publishes it to Google Play. --auto-version-code writes android.versionCode to the sandbox’s copy of app.json before prebuild, and fails the build when the app has no app.json.

Next steps

Last updated on