Laravel has a new Laravel CLI, a single binary that creates Laravel applications in PHP or Rust and runs their console commands. Taylor Otwell shared details on X after the Laravel Rust announcement:
The new Laravel CLI is a single binary you install and it can create Laravel apps in any stack.
The Laravel CLI shipped alongside the first beta of Laravel Rust (announcement post). If you already have the Composer installer or Laravel Herd, your shell might still find the older laravel binary first. The steps to check and fix that are below.
How the Laravel CLI Works
Running laravel new now starts by asking which language you want to use:
laravel new example-app
You can choose PHP or Rust at the prompt. To skip the question, such as in a script, pass --php or --rust:
laravel new example-app --rust
The CLI also runs your application's own commands. According to Taylor, it proxies to php artisan or cargo run for you, depending on the application you are in. You run a command through laravel from the application's directory or any directory inside it:
laravel route:list laravel migrate laravel list
In a Rust application, the CLI compiles the application first and then runs the command you name. It shows the compiler's output only when the build fails. Rust applications also have a laravel dev command, which starts the application, a queue worker, and Vite Plus together.
Installing the Laravel CLI
On macOS and Linux, install the CLI with the install script:
curl -fsSL https://laravel.com/install.sh | sh
On Windows, run this command in PowerShell:
powershell -ExecutionPolicy Bypass -c "irm https://laravel.com/install.ps1 | iex"
The installer puts the laravel command in ~/.laravel/bin (%USERPROFILE%\.laravel\bin on Windows) and adds that directory to your PATH. Open a new terminal before you use it.
The install script accepts a --no-modify-path option if you would rather add the directory to your PATH yourself.
The version at the time of writing is 0.3.0. Prebuilt binaries are published in the laravel/cli-releases repository for these platforms:
- macOS on Apple Silicon and Intel
- Linux on x64 and ARM64, plus an x64 musl build
- Windows on x64 and ARM64
Switching From the Composer Installer
The Composer-based Laravel installer and Laravel Herd both provide a laravel command too. After you install the CLI, open a new terminal and check which binary your shell finds first:
laravel --version
The output should start with Laravel CLI. If you see something like Laravel Installer 5.32.0, another directory appears ahead of ~/.laravel/bin on your PATH. List every laravel binary your shell can find with this command on macOS and Linux:
which -a laravel
In PowerShell on Windows, use Get-Command laravel -All.
To keep the older installer and put the new CLI first on macOS and Linux, move the PATH line that the installer added to your shell profile (such as ~/.zshrc or ~/.bashrc) below any Herd or Composer PATH entries. On Windows, move %USERPROFILE%\.laravel\bin above the Herd or Composer directory in your user Path environment variable.
Then open a new terminal and run laravel --version again to confirm.
Removing the Composer Global Installer
If you installed the older installer with composer global require laravel/installer and no longer need it, you can remove it instead of reordering your PATH. First, confirm that Composer has it installed globally:
composer global show laravel/installer
Then remove it:
composer global remove laravel/installer
Composer deletes the package and its laravel binary from the global vendor/bin directory. Your other global Composer packages stay installed. You can print the location of that directory with this command:
composer global config bin-dir --absolute
Open a new terminal and run which -a laravel again. The Composer path should be gone from the list, and laravel --version should start with Laravel CLI. If Herd's laravel binary still comes first, the PATH change above still applies.
Updating the Laravel CLI
You no longer update the installer with composer global update. When a newer version of the CLI is released, laravel new tells you and offers to update it for you.
See the Laravel CLI sections of the Laravel PHP installation docs and the Laravel Rust installation docs for the full setup instructions.