Skip to content

Installation

Install the laravel-mobile CLI, add mobile to your Laravel Rust application, and open it on your phone.

Introduction

In this guide, you’ll add a mobile app to an existing Laravel Rust and Inertia application and open it on your phone. Every step works with its defaults, so feel free to press Enter through the prompts. You can always change your answers later in mobile.toml.

Installing the CLI

Before you begin, make sure your machine meets the requirements. Then, install the laravel-mobile CLI from crates.io using Cargo:

cargo install laravel-mobile-cli

Once it finishes, the laravel-mobile command is available everywhere on your machine. To upgrade later, run the same command again.

Adding Mobile to Your Application

Once the CLI is installed, run the init command from the root of your Laravel Rust application:

cd my-app
laravel-mobile init

The init command asks for your app’s name, its bundle ID, and the production URL it should load, suggesting answers from your .env and Cargo.toml files. A bundle ID suggested from a name keeps only letters and digits in each part, so a package called endo-baddie suggests com.example.endobaddie. It then creates mobile.toml, the Tauri shell in apps/mobile, and the crates/shared crate, and adds them to your Cargo workspace. Until Lairport is on crates.io, it also copies the package to vendor/ and points Cargo at that copy, so commit vendor/ with your app. Finally, it adds the @laravel-rust-mobile/core JavaScript adapter and the Tauri CLI to your package.json file and installs them, using npm, pnpm, Yarn, or Bun, whichever your lockfile shows you use:

◆ Created mobile.toml, apps/mobile, and crates/shared.
◆ Added apps/mobile and crates/shared to the Cargo workspace.
◇ Running npm install...
◆ Added @laravel-rust-mobile/core and @tauri-apps/cli to package.json and installed them.

Next steps
  1. laravel-mobile doctor   check the iOS and Android toolchains
  2. laravel-mobile dev      open the app on a phone on your network
  3. laravel-mobile dev ios  or run it in the iOS simulator (dev android for Android)

You may also add features during setup with the --with option. For example, this adds a native tab bar and a SQLite database:

laravel-mobile init --with tabs,sqlite

In a terminal, init shows the same features as a checklist, so you may choose them there instead. The Next steps suggest laravel-mobile install tabs when you haven’t chosen tabs. You can add a feature to an existing app at any time with laravel-mobile install:

laravel-mobile install tabs

A paid feature, such as sqlite, prints a notice that says where its plugin comes from when you add it.

If you would like to accept every default without being prompted, you may provide the --yes option:

laravel-mobile init --yes

Or, if you would like to see exactly what init will change before it writes anything, you may use the --dry-run option:

laravel-mobile init --dry-run

Adding Mobile with Your Coding Agent

If you would rather your coding agent add mobile to your application, you may install the adding-mobile-apps skill before you run init. The skill reads your application, explains what a mobile app would add, runs laravel-mobile init for you, and helps you with any output it doesn’t expect. It supports Laravel Rust applications only, and it costs nothing to use.

To install it, copy the adding-mobile-apps folder from the skills directory of the laravel-rust-mobile repository into your project’s .agents/skills directory. Then ask your agent to add mobile to the application:

Add mobile to this app with the adding-mobile-apps skill

Of course, you may also run init yourself. In a terminal, init then asks whether to have your coding agent review the application and suggest mobile features. If you say yes, it prints a prompt to paste into your agent:

Review this app for mobile with the building-mobile-apps skill

The agent reads your routes, layouts, and pages, then suggests features as a short list, such as a native tab bar from your main navigation, an offline page in your app’s style, or push notifications for the notifications your app sends. Paid features are marked as paid. The agent changes nothing until you agree to a suggestion, and each one is added with laravel-mobile install.

Checking Your Machine

Mobile toolchains have a lot of moving parts. To make sure yours are ready, run the doctor command:

laravel-mobile doctor

The doctor command checks your project, the Tauri CLI, Rust, Node, and the iOS and Android toolchains. When a check fails, doctor shows you the exact command that fixes it. For example, on a fresh clone of your project where dependencies aren’t installed yet:

Project
■ Tauri CLI  @tauri-apps/cli is in package.json but not installed
    fix: npm install

■ 1 check failed, 0 warnings.
  Run laravel-mobile doctor --fix to fix 1 problem.

Of course, you don’t need to copy those commands yourself. The --fix option runs each fix for you from your project’s root, then checks again:

laravel-mobile doctor --fix

Opening Your App on a Phone

Now you’re ready to see your app on a phone. Start the development server using the dev command:

laravel-mobile dev

The dev command starts your Laravel Rust server, queue worker, and Vite on your network address, then prints a QR code. Scan it with your phone’s camera to open your app in the phone’s browser; your phone just needs to be on the same network:

Acme is running on your network at 192.168.1.20 (en0). Pass --host if your phone cannot reach it.
  App     http://192.168.1.20:8000
  Vite    http://192.168.1.20:5173

  Scan with your phone's camera to open the app in its browser:

The address line names the network interface that dev chose. If your phone can’t reach that address, for example because a VPN or a container network is in the way, pass the address your phone should use with --host.

If you would like to run the native app in the iOS simulator or an Android emulator instead, you may pass the platform to the dev command:

laravel-mobile dev ios

The browser preview shows your pages but not your native plugins, while the simulator runs your real native app. The running your app documentation explains the difference, and how to run on a physical device.

Next Steps

Now that your app is running on a phone, you may be wondering what to learn next. We recommend the following documentation:

Type to search…

↑↓ navigate↵ selectEsc close