Skip to content

Running Your App

Preview your app in a phone's browser, run it natively in the iOS simulator, an Android emulator, or on a device, and learn what each one can test.

Introduction

While you build your app, there are three ways to see it on a phone. Each one trades setup for how much of the native app you can test, so it’s worth knowing which to reach for:

Browser Simulator Device
Command dev dev ios, dev android dev ios --device
Needs Xcode or Android SDK No Yes Yes
Without a Mac iPhone and Android Android only Android only
Live reload of your pages Yes Yes Yes
Server changes Reload the page Pull down or relaunch Pull down or relaunch
Native plugins No Yes Yes
Native splash and icon No Yes Yes

Previewing in a Phone’s Browser

The quickest way to see your app on a phone is the dev command with no platform:

laravel-mobile dev

The dev command starts your server, queue worker, and Vite on your network address, then prints a QR code. If your .env file broadcasts through a local Reverb server, dev starts that server too. See troubleshooting for the conditions. Scan it with your phone’s camera, and your app opens in the phone’s browser. Your phone must be on the same network as your computer; if the page doesn’t load, see troubleshooting.

This preview needs nothing but a phone on the same network, so it’s a great way to check layouts and flows on a real screen, even from Linux or Windows. However, it is a browser, not your native app. Native plugins aren’t available, so mobile.isNative() returns false and each @laravel-rust-mobile/core call uses its web fallback or does nothing.

Previewing from Another Network

The QR code works only when the phone is on the same network as your computer. If your phone is somewhere else, such as on mobile data, pass the --tunnel option to dev. It reaches your app at a public HTTPS address that works from anywhere:

laravel-mobile dev --tunnel

If you would like to choose the tunnel program yourself, name it after the option. You may use cloudflared for its quick tunnels, which need no account, or expose for Expose, the tunnel behind Herd’s and Valet’s share:

laravel-mobile dev --tunnel cloudflared

Install cloudflared or Expose first. Without either one, dev stops and names the program to install, with the error code dev::tunnel_missing. A tunnel can also fail to start, with dev::tunnel_failed, in which case the message says what to check.

When dev starts your server, it sets APP_URL to the tunnel’s address, so redirects and links work through the tunnel. If you run with --no-server and start your own server, set APP_URL in .env to the address dev prints.

A tunnel reaches a single port, so dev builds your assets and rebuilds them when you save a file, instead of serving them through Vite’s development server. To see a change on your phone, pull down to refresh the page. The --tunnel option conflicts with --host and --device, because the tunnel replaces both.

Anyone with the tunnel’s address can open your development server while the command runs, so stop dev when you have finished testing.

Running in a Simulator or Emulator

To run your real native app, pass the platform to the dev command:

laravel-mobile dev ios

laravel-mobile dev android

The first run creates the Xcode or Gradle project and compiles the app, which can take several minutes. After that, the app opens in the iOS simulator or Android emulator, pointed at the server on your machine.

From then on, changes to your Inertia pages appear within a few seconds through Vite, just as they do in a browser. If you change Rust code in apps/mobile, Tauri rebuilds and relaunches the app for you.

Sessions, login, forms and file uploads all work in dev on a device, just as they do in a release build.

Changes to your Laravel Rust server work a little differently. When you edit a Rust file, dev restarts the server, and the open page reloads through Laravel Rust’s own /_laravel/reload stream. On a phone over USB, an edited route appeared about five seconds after the restart, without a full reload or a relaunch. If you change mobile.toml, such as enabling a plugin or adding a permission, stop dev and start it again so the native project picks up the change.

The iOS simulator only runs on a Mac with Xcode. The Android emulator runs on macOS, Linux, and Windows, using the Android SDK’s emulator.

Running on a Device

To run on a phone connected to your machine, provide the --device option with the device’s name, such as “iPhone 17 Pro” or “Pixel 9”. For Android, you may also use the serial number that adb devices lists:

laravel-mobile dev android --device "Pixel 9"

For Android, plug the phone in over USB and allow USB debugging when it asks.

If a release build of your app, or a build with a higher build number, is already installed on the phone, dev android stops before it builds. It prints the adb uninstall command to remove the installed app. Be aware that uninstalling also deletes the app’s data on the device.

When a phone or emulator is connected this way, dev forwards the server and Vite ports with adb reverse, so the app loads from 127.0.0.1 and works even on Wi-Fi that isolates devices. The forwards are removed when dev stops. To keep the network path instead, pass --host.

For an iPhone, you’ll need a Mac and an Apple Developer team, since every app on an iPhone must be signed. Add your team ID to mobile.toml, then enable developer mode on the iPhone:

mobile.tomltoml
[ios]
team_id = "ABCDE12345"
laravel-mobile dev ios --device "Taylor's iPhone"

Running on Your Computer

To run your app as a desktop app on macOS, Windows, or Linux, run dev desktop. It opens the app in a resizable window on this computer, and the window reloads when you change your pages:

laravel-mobile dev desktop

The app is served on 127.0.0.1, so only this computer can reach it. The desktop uses the same mobile.toml and pages as your phone app. Plugins that also run on the desktop, such as the clipboard, dialog, and notification plugins, work as they do on a phone. Haptics, biometrics, and the scanner do nothing on the desktop, as in a browser. Check mobile.isDesktop() before you call them, or read mobile.platform() to tell 'macos', 'windows', and 'linux' apart.

Developing Without a Mac

Apple only ships Xcode and the iOS simulator for macOS, so on Linux and Windows you have fewer options for iOS:

  • Android: everything works, including the emulator, devices, and release builds.
  • iPhone: you may preview your pages in the phone’s browser with laravel-mobile dev, but you can’t run the native app, test native plugins, or build for the App Store.

Two planned features close this gap. The prebuilt dev client (v0.2) will let you run your native plugins on an iPhone from any machine, and cloud builds will compile and sign your iOS app without a Mac. Until then, iOS work needs a Mac, whether your own, a borrowed one, or a hosted Mac in CI.

Type to search…

↑↓ navigate↵ selectEsc close