This may be a very noob question, but I'm trying to install Homestead on my Mac. I'm following installation steps via http://laravel.com/docs/4.2/homestead however there is a point in the installation process where it state "Make sure to place the ~/.composer/vendor/bin directory in your PATH so the homestead executable is found when you run the homestead command in your terminal." How do I do this using zsh? Thanks!
How do I place the ~/.composer/vendor/bin directory in your PATH using .zshrc
in whichever profile you're using (.zprofile or .profile or whatever), you would add the line:
export PATH = ~/.composer/vendor/bin:$PATH
then reload your profile
source ~/.zprofile
How do I access .zprofile? I tried vi ~/.zprofile but it only creates a new file –
Mont
Then you're not using .zprofile. See which profile file you're using already; could be ~/.profile or ~/.bash_profile or ~/.bashrc, or ~/.zshrc. there's a few more but those are the most common. –
Jun
I can access ~/.zshrc however when I put PATH = ~/.composer/vendor/bin:$PATH , save and source ~/.zshrc I get /Users/username/.zshrc:83: command not found: PATH –
Mont
Never mind, got it. added export PATH=/Users/username/.composer/vendor/bin:$PATH Thanks for your help Paul! –
Mont
That "source ~/.zprofile" was what I was missing. Thanks –
Violetavioletta
I had the same issue until I added
export PATH=/Users/username/.composer/vendor/bin:$PATH
. I tried adding export PATH=~/.composer/vendor/bin:$PATH
as recommended in the Laravel page but couldn't make it work, luckly I found this thread. Thanks @Mont –
Shoemaker I found for me I had to give the full path rather than using ~ then it worked. –
Severn
If your PATH is in .bashrc file :
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.bashrc
If your PATH is in .zshrc file :
echo 'export PATH="$PATH:$HOME/.composer/vendor/bin"' >> ~/.zshrc
Finally, you should restart your environment
source .bashrc #Bash
source .zshrc #ZSH
I had to type "source .bashrc" to make it work after –
Karli
Update the file ~/.bashrc like this:
PATH="~/.composer/vendor/bin:{$PATH}"
Setup
Mac OS:
echo 'export PATH=$PATH:$HOME/.composer/vendor/bin' >> ~/.zshrc
Linux:
echo 'export PATH=$PATH:$HOME/.config/composer/vendor/bin' >> ~/.zshrc
To apply restart terminal or:
source ~/.zshrc
To check if it works:
echo $PATH
$ echo 'export PATH=$PATH:$(composer global config bin-dir --absolute --quiet)' >> ~/.zshrc
TLDR;
A bit more automatic approach to get global vendor/bin
path:
$ composer global config bin-dir --absolute
/Users/me/.composer/vendor/bin
In currently open terminal updating PATH
will work:
$ PATH=$(composer global config bin-dir --absolute --quiet):$PATH
As it's expected to have global tools always available, we can add it in ~/.zshrc
or others, plus:
- consider a difference should it be prepended or appended to the
PATH
, - and use single quotes:
$ echo 'export PATH=$(composer global config bin-dir --absolute --quiet):$PATH' >> ~/.zshrc
In one of your start files within home directory (~/.bashrc or ~/.zshrc)
export laravel=/Users/username/.composer/vendor/bin
export PATH="$laravel:$PATH"
© 2022 - 2024 — McMap. All rights reserved.