Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Ionut's avatar

zsh: command not found: homestead

Hi everyone,

I am trying to install Homestead 2.0.

Following Jeffrey's guidelines and the docs I did the

 composer global require "laravel/homestead=~2.0"

 export PATH="~/.composer/vendor/bin/"

I even add it to my .zshrc file, but I get the same error.

When I try to run it, it says:

 zsh: command not found: homestead

I'm using oh-my-zsh, have Composer installed.

I get the same with

 composer global require "laravel/installer=~1.1"

What am I doing wrong here?

0 likes
23 replies
bashy's avatar

Try display your path

echo $PATH

Can see if it can pick it up with

which homestead

If that doesn't return anything, it can't find it in your PATH settings.

which -- locate a program file in the user's path

1 like
Ionut's avatar

Hey @bashy,

Thanks for the reply. I did

 echo $PATH

Result:

 ~/.composer/vendor/bin/

Which:

 which homestead
 homestead not found
bashy's avatar

Your path should have other paths like /usr/local/bin etc.

Did you replace over the original path value?

1 like
Ionut's avatar

I did not replace anything. At least I don't think so.

My MacBook is new so all that I installed is composer in order to install the Laravel stuff. I am trying to keep the other development stuff in the VMs.

I rebooted today. Now when I run

 echo $PATH

I get

 /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
HRcc's avatar
HRcc
Best Answer
Level 22

Instead of this

export PATH="~/.composer/vendor/bin/"

I believe you really wanted this - append to path you already have

PATH=~/.composer/vendor/bin:$PATH
20 likes
Ionut's avatar

@HRcc thanks!! it worked!

But is it for the current terminal session, right? I have to put it in the .zshrc file right?

HRcc's avatar

Yes, keep it in .zshrc :)

1 like
assoft's avatar

Hi,

Macbook Pro, shell oh-my-zsh my .zprofile =>
export PATH="~/.composer/vendor/bin:$PATH"
source .zprofile
end terminal session and try :
homestead

return :
zsh: command not found: homestead

echo $PATH:
/usr/local/bin /usr/bin /bin /usr/sbin /sbin

pls help me!


My Solution:
sudo nano .zshrc
export PATH=/Users/my_user_name/.composer/vendor/bin:$PATH
source .zshrc

8 likes
Xiteer's avatar

If anyone is having this problem; I found another solution. It looks like the ~ isn't being expanded so you need to replace it with $HOME. So the full string is $HOME/.composer/vendor/bin

14 likes
jrtashjian's avatar

I just ran into this issue today and I will confirm the above solution: Use $HOME instead of tilda (~).

MMIT's avatar

I can also confirm I had the same issue as Xiteer and jrtashjian - once I used $HOME instead of the tilda my issue was resolved.

1 like
beregueder's avatar

The solution is to edit the file that is located

composer.json "~/.composer/"

to

"laravel/homestead":"dev-master"

deepesh's avatar

Paste the following in your .zprofile or .bash_profile: export PATH = ~/.composer/vendor/bin:$PATH

And the reload your profile using the following: source ~/.zprofile

homerocavazos's avatar

I couldn't get it to work either so I added an alias to my .aliases file.

alias homestead='~/.composer/vendor/bin/homestead'

If you don't have a .aliases file, create one and uncomment or add the line . ~/.aliases in your .zshrc file

1 like
avrilverhaeghen's avatar

I've got homestead working, but I'm running into a strange problem on my Mac. Every time I reboot or I close my shell window homestead alias seems to be unknown again when I open up my shell again. I can run "source ~/.bash_profile" again so that the alias is "picked" again and is back to normal. So no biggy here.

But it's a bit annoying. Anyone had this before?

dguardia's avatar

Solved I used @jrtashjian solution $HOME instead ( ~ )
1.- export PATH="$HOME/.composer/vendor/bin:$PATH"
then source ~/.zshrc echo $PATH => not results :(
2.- again ..
export PATH="$HOME/.composer/vendor/bin:$PATH"
echo $PATH => works! /Users/davidguardia/.composer/vendor/bin:/usr/local/........................

sineld's avatar

alias homestead='~/.composer/vendor/bin/homestead'

alias hs='homestead'

works great for me.

$ hs suspend

;)

2 likes
spar_x's avatar

For some reason zsh does not seem to like the tilde for referring to the users directory.

If you do not the absolute path then it didn't work, adding the full path including /Users/my_username/.composer/vendor/bin immediately fixed the problem for me

ikhoai's avatar

After this:

composer global require "laravel/homestead=~2.0"

I added this:

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

And it works with:

homestead
2 likes
asweb's avatar

I use Homestead Box with Windows and the path is different so try this:

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

Or even better when you install Laravel with

composer global require "laravel/installer"

Use the directory from this message to set the PATH to:

Changed current directory to /home/vagrant/.config/composer

Please or to participate in this conversation.