'Laravel "valet install" not found
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.
Solution 1:[1]
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).
Solution 2:[2]
I'm using oh-my-zsh so:
echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.zshrc
source ~/.zshrc
You may replace .zshrc with .bashrc
Solution 3:[3]
Make sure that ~/.composer/vendor/bin directory is in your system's PATH, you can check this by running:
echo $PATH
If not there, open your ~/.bash_profile and add this code:
export PATH=$PATH:~/.composer/vendor/bin
Then run:
composer global require laravel/valet --dev
Once it is done, run:
valet install
Solution 4:[4]
you just have to use:
export PATH="$PATH:$HOME/.composer/vendor/bin"
then
valet install
ready :)
Solution 5:[5]
If you have a fresh installation, you may not have the PATH variable contains your home path. So, adding the $HOME variable would require like the following:
export PATH="$PATH:$HOME/.composer/vendor/bin
Solution 6:[6]
If valet install doesn’t work, but ~/.composer/vendor/bin/valet --version does work, try installing it via
~/.composer/vendor/bin/valet install
To See if that worked, check
valet --version
Solution 7:[7]
In Ubuntu 18.04 do this:
echo "export PATH=$PATH:$HOME/.config/composer/vendor/bin" >> ~/.bashrc
source ~/.bashrc
Solution 8:[8]
This command might solve your problem
test -d ~/.composer && bash ~/.composer/vendor/bin/valet install || bash ~/.config/composer/vendor/bin/valet install
Solution 9:[9]
If you're using zsh, you cannot use ~ as path to home dir, use $HOME instead.
In .zshrc file, instead of adding this:
export PATH=$PATH:~/.composer/vendor/bin
Add this and the path will resolve:
export PATH=$PATH:$HOME/.composer/vendor/bin
Solution 10:[10]
with new composer installation, you need to add a new path which is
export PATH=$PATH:~/.config/composer/vendor/bin
Then you need to
chown YOUR_USERNAME ~/.config
for accessing composer packages without sudo command.
Solution 11:[11]
I have installed Composer version 2 and found that composer default path is ~/.config/composer/ and similarly valet is also installed on /.config/composer/vendor/bin/valet.
So to solve this issues I added the composer path to ~/.bashrc file as:
export PATH=$PATH:~/.config/composer/vendor/bin
Solution 12:[12]
Add ~/.composer/vendor/bin directory to your PATH variable.
Solution 13:[13]
For me worked
write in console
cd ~/.composer/vendor/binpwdcopy pwd command resultexport PATH=$PATH: (pwd command result)valet install
I think I explained well
Solution 14:[14]
In my case I've to update /etc/profile file added
export PATH=$PATH:~/.composer/vendor/bin
in
/etc/profile
then
source ~/etc/profile
Solution 15:[15]
I found a fix on this website, and it fixed my issue.
test -d ~/.composer && bash ~/.composer/vendor/bin/valet install || bash ~/.config/composer/vendor/bin/valet install
Solution 16:[16]
In my case I found the valet location by manual search
Then add the the valet file path to PATH variable
echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc
Then I ran the install command and it worked
valet install
Solution 17:[17]
Php may be not installed
Use your prefered version with:
brew install php
// or
brew install [email protected]
// or
brew install [email protected]
This solved my issue.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow

