Laravel "valet install" not found

Solution 1:

Yes, you need to make sure that ~/.composer/vendor/bin directory is in your system's PATH, you can check this by running:

echo $PATH

If you can't see it there, then you need to add this to your ~/.bash_profile:

export PATH=$PATH:~/.composer/vendor/bin

Solution 2:

If you're getting the error message "valet: command not found", it's likely that PHP's Composer is not in your PATH variable, for instance:

$ valet install
-bash: valet: command not found

You can confirm if Laravel Valet was successfully installed by running the following command:

ls -al ~/.composer/vendor/bin/valet

If successfull, you'll see the symlink for Valet in Composer's bin directory pointing to Laravel in the vendor directory:

~/.composer/vendor/bin/valet@ -> ../laravel/valet/valet

To test whether your PATH is missing Composer, try running the Valet command directly:

~/.composer/vendor/bin/valet --version

If you're shown the Laravel version number, (e.g. Laravel Valet 2.0.4), this indicates Valet is installed but you need to update your PATH variable to include Composer for the valet command to work globally.

In your Terminal, execute the following command which will append Composer to your shell's PATH:

export PATH=$PATH:~/.composer/vendor/bin

For the changes to take effect, you'll need to exit and re-open your Terminal window or tab.

Alternatively, you can simply source your shell's profile, which doesn't require quitting your active session:

source ~/.bash_profile

If you have a different shell environment or you're using a shell other than Bash, you will need to source its configuration profile instead (e.g. .bashrc, .zshrc, config.fish).