You install the Laravel CLI on a Mac. The installer says everything went fine, but the next command fails:
downloading laravel-cli 0.3.0 aarch64-apple-darwin
installing to /Users/yourname/.laravel/bin
laravel
everything's installed!
% laravel new rust-app --rust
zsh: command not found: laravel
The install worked. Your terminal just can’t find the new command yet.
Why it happens
The installer put the laravel program in ~/.laravel/bin. Your terminal only runs commands from folders listed in PATH. If ~/.laravel/bin isn’t in the PATH of the window you’re using, zsh says “command not found”. This is the same cause as zsh: command not found: rustc, and a terminal window that was open during the install keeps its old PATH.
Step 1: Check the program is there
ls ~/.laravel/bin
You should see laravel. If the folder is empty or missing, run the installer again:
curl -fsSL https://laravel.com/install.sh | sh
Step 2: Run it with the full path
~/.laravel/bin/laravel --version
If this prints a version, the CLI is fine and only PATH is the problem.
Step 3: Add it to PATH for the current window
export PATH="$HOME/.laravel/bin:$PATH"
laravel --version
The output should start with Laravel CLI. This only lasts until you close the window.
Step 4: Make it permanent
Add the same line to your zsh config, then reload it:
echo 'export PATH="$HOME/.laravel/bin:$PATH"' >> ~/.zshrc
source ~/.zshrc
Open a new terminal tab and run laravel --version again. Putting the folder first in PATH also avoids the problem in Fix: “shadowed by other commands in your PATH”, where Herd or the Composer installer runs instead.
Step 5: Create your app
laravel new rust-app --rust
If you get The "--rust" option does not exist, an older laravel command is running. See that fix. For the full setup, see How to Install Laravel Rust on macOS.
Quick check
| What you see | What to do |
|---|---|
ls ~/.laravel/bin shows nothing |
Re-run the installer (Step 1) |
Full path works, plain laravel fails |
Add to PATH (Steps 3 and 4) |
| Works in this window, fails in a new one | Add the line to ~/.zshrc (Step 4) |
Wrong laravel runs |
See the shadowed-command fix above |
FAQ
Do I need to reinstall? No, unless ~/.laravel/bin is empty.
Do I need sudo? No. It installs into your home folder.
Which shell file should I edit? zsh is the macOS default, so ~/.zshrc. If you use bash, use ~/.bash_profile instead.
Sources:
