
Install the installer first with composer global require laravel/installer, then ask Composer where it puts its executables: composer global config bin-dir --absolute. Add that path to your PATH in ~/.zshrc, then run source ~/.zshrc. On macOS with bash, the file is ~/.bash_profile, never ~/.bashrc.
You type laravel new my-project and the terminal answers:
zsh: command not found: laravelThe problem is almost never Laravel. It is that the executable installed by Composer sits in a folder your shell never looks at. So you need to find that folder, then add it to your PATH.
Part of the Web development reading path. Procedure verified on 2 September 2026 on macOS 26.5.1 with Composer 2.9.5 and zsh.
First: is the installer actually installed?
The laravel command does not ship with Composer, it is installed separately:
composer global require laravel/installerIf you have never run that, no amount of PATH tweaking will make the command appear. And you can happily do without it: composer create-project laravel/laravel my-project does the same job with no global installer.
Finding the right folder instead of guessing it
Most tutorials have you copy $HOME/.composer/vendor/bin. That is often right, but not always: Composer picks its home folder according to the system and to the environment variables it finds. Rather than betting on it, ask it:
composer global config bin-dir --absolute/Users/gekkode/.composer/vendor/binThat is the result on macOS 26.5.1. On an installation set up to follow the XDG conventions, the command may return ~/.config/composer/vendor/bin. Always use what the command prints on your machine, not what a tutorial says.
As long as no global package is installed, the path is correct but the folder is missing. That causes no trouble at all: adding a non-existent folder to your PATH raises no error, and it will be created by the first composer global require.
Adding the folder to your PATH with zsh
zsh has been the default macOS shell since Catalina. The file to edit is ~/.zshrc:
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.zshrc
source ~/.zshrcReplace the path with the one the previous command returned. The source applies the change to the current session, without it, it only takes effect in a new terminal.
Check it:
which laravel
laravel --versionAnd if you use bash
On macOS Mojave and earlier, or if you have deliberately stuck with bash, the file is ~/.bash_profile:
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profileThis is the classic mistake, and the previous version of this article made it. On macOS, Terminal opens a login shell, which reads ~/.bash_profile and not ~/.bashrc. A line added to ~/.bashrc will never be applied, which makes it look as though the whole thing does not work.
To find out which shell you are running:
echo $SHELL
# /bin/zsh → ~/.zshrc
# /bin/bash → ~/.bash_profileIf the command is still not found
Three checks, in order. First, does your PATH really contain the folder:
echo $PATH | tr ':' '\n' | grep composerNext, is the executable there:
ls "$(composer global config bin-dir --absolute)"If it is missing, the global install failed. Run it again and read the output: a PHP version conflict is the most common cause.
Finally, if Composer itself cannot be found, it is the same problem one level down. On macOS, the simplest install goes through Homebrew:
brew install composerOn a server the question comes up in rather different terms: see installing Composer on Debian.
The alternative that removes the problem
Laravel Herd installs PHP, Composer and the Laravel installer in a managed environment, and takes care of the PATH itself. For a macOS development machine built from scratch, it is the shortest route: there is no shell configuration file left to touch.
If you already work with a Homebrew installation you know your way around, the PATH approach described above remains perfectly valid.
Common errors
~/.bash_profile. A line added to ~/.bashrc is never applied.composer global config bin-dir --absolute gives the right path on your machine.source on the file you edited.

