I am trying to set up Laravels Valet (Valet is a Laravel development environment for Mac). Everything works until it comes to the command "valet install". This command must be executed in terminal. But I got the error "command not found". Any ideas, why? Do I have to update my PATH or something else?
I switched to OS X a few days ago. Before that, I was a windows user. So I am a total newbie.
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
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
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With