3

I just tried installing valet for a very long time, - and I couldn't find any help anywhere. No matter what I tried, then it kept saying:

Zsh: command not found: valet

I'm running Zshell (instead of Bash) and OSX. I've had Brew installed for quite a while.

I'll answer this myself, - so hopefully people in the same situation can find this in the future.

Zeth
  • 2,273
  • 4
  • 43
  • 91

5 Answers5

6

Everywhere it says to 'Check that your path is right'. And yup - if you haven't done that, then you should start there. The easiest way is to go to your terminal and write:

echo $PATH

... And then you should see ~/.composer/vendor/bin in between two colons in there. If that isn't there, then you should go to your ~/.bashrc-file (or ~/.zshrc-file) and add this line:

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

And then it may be fixed.

My problem had deeper roots, though. Even though my path was right, then I still got the error:

Zsh: command not found: valet

And if I wrote: which valet - then it (obviously) just responded with valet not found.

Removal of Composer

What fixed it was to remove all my composer-installations. Composer can be located in several different locations (and installed by brew). So in order to remove it, then do this (inspired by this post, but it lacks a couple of steps):

  • Remove your composer- or -composer.phar-file. You can find them by running which composer and/or which composer.phar.
  • Remove your .composer-folder (usually located here: ~/.composer).
  • Then make sure that there isn't an installation done with Homebrew (this was what I think made the collision for me). You do it by running brew unlink composer followed by brew remove composer.
  • Then, - if you want to be 100% sure that it's all gone, then go to your root (cd /) and run this command: find ./* -name 'composer.phar' and this find ./* -name 'composer'. That should tell you of all the locations where the Composer-installation can be installed.

When all that's removed, then you should be rid of Composer (entirely). ... Then install it again, - and see if you can get valet to work (it did for me).

Zeth
  • 2,273
  • 4
  • 43
  • 91
6

The solution was adding composer bin to the path. You can use the following commands

From the terminal

  1. export PATH="$PATH:$HOME/.composer/vendor/bin"
  2. echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bash_profile
  3. source ~/.bash_profile
  4. valet install
5

I had a very similar problem under Zsh, but my solution was easier. Rather than adding ~/.composer/vendor/bin to my $PATH, I needed to use the full directory name; i.e., /Users/[your-user-name]/.composer/vendor/bin.

sevenpointsix
  • 394
  • 5
  • 4
2

I tried all above, but always

zsh: command not found: valet

My solution was to have the path like this:

export PATH="$PATH:$HOME/.composer/vendor/bin"

(with a $HOME instead of ~)

0

Issue Ubuntu: no command valet

Valet on Ubuntu:

sudo apt install libnss3-tools jq xsel

composer global require cpriego/valet-linux

.composer/vendor/cpriego/valet-linux/valet install

Now command valet should work, but if still not:

sudo cp .composer/vendor/cpriego/valet-linux/valet /usr/local/bin/

BartZalas
  • 305
  • 5
  • 12