How to place ~/.composer/vendor/bin in your zsh PATHFebruary 29, 2016
For many days now I've been struggling with this annoying problem with my zsh terminal. I was unable to use
laravel as single-worded commands. I had to type the whole instructions to execute that pair of bins, meaning:
~/.composer/vendor/bin/homestead up and
~/.composer/vendor/bin/laravel new. Note that this difficulty was present despite the fact that I apparently added that directory to my zsh $PATH.
The problem is gone now. Sure, I could just made an alias out of those two executables and be done in just minutes but that's not elegant. Yesterday I finally decided to research a bit deeper and found a life-saver comment at Stack Overflow.
Tell me how to already
I took some of your time with that boring introduction. My bad. Now, let's go act.
For some reason the .zshrc file doesn't recognize the universal symbol for the $HOME directory, meaning:
~. Instead you have to manually type the whole /path/to/composer/vendor/bin or, which is better, save some bytes and use some abstraction using the
Take a look at this step-by-step for a one-liner.
- Fire up your shell, make sure you are at $HOME or where your .zshrc file is located.
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH' >> .zshrc.
- Now type in
- That's it. If you want to see how yor zsh shines even after a restart just do it.
Good for you.