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

sasafister's avatar

Homestead 2.0 setup

Hi,

i have stucked on beginning. What does this mean? Do i have to put it into bash_profile? What exactly do i have to write down?

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.
0 likes
13 replies
otepas's avatar

Yes, you have to add it to one of your shell configuration files. Depending on your configuration it could be .bash_profile, .profile, .bashrc...

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

You will also have to open a new terminal so that the config file is reloaded and the changes are applied.

2 likes
sasafister's avatar

Hm thnx @otepas but when i restart iterm and try to launch homestead, nothing happen's

Zimos-MacBook-Air:~ sasa$ homestead
-bash: homestead: command not found
Zimos-MacBook-Air:~ sasa$
1 like
sasafister's avatar
sasafister
OP
Best Answer
Level 10

I found solution in comments:

I figured it out. to all other noobs first type "vi ~/.zshrc" to edit .zshrc file. next press "i" on keyboard to go into insert mode. go to bottom and add the this line "export PATH=/Users/yourusername/.composer/vendor/bin:$PATH" , next press esc to exit insert mode, type ":w" to save then type ":q" to exit and then make sure you type "source ~/.zshrc" before closing terminal window
3 likes
mikebarwick's avatar

@otepas has the right idea...

On mac...do this so you don't always need to specify the path:

sudo nano .bash_profile

Enter your password when prompted, then add this to the last line (CTRL+X, Then "Y", and ENTER to save):

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

Once back at the terminal screen, COMMAND+N to create a new terminal window. This will reset path, blah blah. In old terminal window, type EXIT, then COMMAND+Q to close it. Continue and work in the new terminal window...

2 likes
henrya's avatar

I followed the steps below and every time I closed the terminal and then open the terminal again never worked..

Figured it out. to all other noobs first type "vi ~/.zshrc" to edit .zshrc file. next press "i" on keyboard to go into insert mode. go to bottom and add the this line "export PATH=/Users/yourusername/.composer/vendor/bin:$PATH" , next press esc to exit insert mode, type ":w" to save then type ":q" to exit and then make sure you type "source ~/.zshrc" before closing terminal window

Every time you open the terminal you will have to execute "source ~/.zshrc" in order for you to be able to call laravel and homestead .

1 like
chuckc's avatar

Thanks sasafister, at least it works... But is there any way to avoid the need to execute "source ~/.zshrc" everytime I open a new terminal and want to call laravel and homestead ?

Keilnoth's avatar

Cannot init homestead here. Seems it's buggy when using a space in your username on Windows... :(

$ homestead.bat init

Warning: mkdir(): Invalid argument in C:\Users\My Name\AppData\Roaming\Composer\vendor\laravel\homestead\src\InitCommand.php on line 35

Warning: copy("C:\cygwin64\home\My Name/.homestead"/Homestead.yaml): failed to open stream: Invalid argument in C:\Users\My Name\AppData\Roaming\Composer\vendor\laravel\homestead\src\InitCommand.php on line 37

Warning: copy("C:\cygwin64\home\My Name/.homestead"/after.sh): failed to open stream: Invalid argument in C:\Users\My Name\AppData\Roaming\Composer\vendor\laravel\homestead\src\InitCommand.php on line 38

Warning: copy("C:\cygwin64\home\My Name/.homestead"/aliases): failed to open stream: Invalid argument in C:\Users\My Name\AppData\Roaming\Composer\vendor\laravel\homestead\src\InitCommand.php on line 39 Creating Homestead.yaml file... Ô£ö Homestead.yaml file created at: "C:\cygwin64\home\My Name/.homestead"/Homestead.yaml

gwp's avatar

@chuckc ~/.zshrc will be used whenever a zsh shell is opened. You need not source that file unless you have made changes.

gwp's avatar

@Keilnoth Generally programs won't like spaces in usernames on windows. You should start your own thread rather than hijacking this one.

chuckc's avatar

@gwp So it's not normal that I have to type "source ~/.zshrc" everytime I open a new terminal ?

chuckc's avatar

Yes I'm sure :/... I just checked again

iMac:~ chuckc$ homestead
-bash: homestead: command not found
iMac:~ chuckc$ source ~/.zshrc
iMac:~ chuckc$ homestead
Laravel Homestead version 2.1.6

EDIT: Ok, I'm a f*cking noob. I was doing it with the simple bash shell that comes with osx. I installed zsh and put the line again on .zshrc, it's ok now.

Please or to participate in this conversation.