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

RichardDuffy's avatar

When I restart terminal homestead will not work!

Hey,

When I restart terminal the command homestead will not work?

Regards,

Richard.

0 likes
30 replies
mstnorris's avatar

Where have you added the alias? It sounds like you are doing it on the fly and it isn't being persisted.

Are you using a Mac? If so, in your ~/.bashrc file you can add a few things like:

alias he='homestead edit'
alias hu='homestead up'
alias hs='homestead ssh'
alias hi='homestead up; sleep 10; homestead ssh'
alias hp='homestead provision'

From your previous post, you were using Windows, so if that still is the case, check out this article.

1 like
bashy's avatar

@mstnorris What is this command :D

homestead up; sleep 10; homestead ssh

Why the sleep?

1 like
mstnorris's avatar

Because on my machine it always timesout while trying to connect via SSH, as if it is trying too early. I added that so it will give it time. Obviously, they should only run once the previous command has finished but it does help.

1 like
RichardDuffy's avatar

Hey,

Thanks for getting back to me. I am using the PATH=~/.composer/vendor/bin:$PATH command, but I my bashrc file is empty.

Regards,

Richard.

RichardDuffy's avatar

Hey,

No, I don't understand how to add the homestead file to my path, the composer file worked fine.

Regards,

RIchard.

mstnorris's avatar

You don't add it to your path, you add an alias like I showed above to the command.

RichardDuffy's avatar

Hey,

I am getting a read-only error when I try to save the bash file now.

[ Error writing /Volumes/Untitled/Users/Richard/.bashrc: Read-only file system ]

Regards,

Richard.

mstnorris's avatar

That's because you need to edit the file as sudo

sudo nano ~/.bashrc

Make your changes and then CTRL + X to exit the nano editor and the Y to persist the changes.

RichardDuffy's avatar

Hey,

I get the error message when I use sudo.

Regards,

Richard.

RichardDuffy's avatar

Hey,

I have found the error, In don't have a bash.rc file, It was on my windows partition the one I was trying to edit. How do I go about creating a bash.rc file?

Regards,

Richard

mstnorris's avatar

Firstly it is .bashrc

You create a file from the command line like so:

touch ~/.bashrc

Then you can edit it:

nano ~/.bashrc
RichardDuffy's avatar

Hey,

One final thing, what is the alias I need to include to run the homestead command?

Thank you for your help you have been a great sport!

Regards,

Richard.

mstnorris's avatar
Level 55

What happens when you just run homestead ?

If you get "Command not found" then the directory where homestead resides needs to be added to your $PATH.

Type $PATH into the Terminal and paste your output here.

You will also need to add these two lines to your ~/.bashrc file too:

export PATH=./vendor/bin:$PATH
export PATH=~/.composer/vendor/bin:$PATH
1 like
RichardDuffy's avatar

PATH: bash: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory

RichardDuffy's avatar

The aliases only work on the one terminal page, it looks like they are not being saved.

RichardDuffy's avatar

And it only works when I run the export commands but when I open a new terminal I have to run the export commands again.

mstnorris's avatar

Create a new ~/.bash_profile file and add the following:

if [ -f ~/.bashrc ]; then
    source ~/.bashrc
fi

Once you've done that you need to either restart the Terminal or run source ~/.bashrc to reload the file so the changes take effect.

See this SO question on what the differences are.

mstnorris's avatar

Can you paste the following

  1. ~/.bashrc
  2. ~/.bash_profile
  3. $PATH
RichardDuffy's avatar

Sorry,

Forgot to add the export to my bash file. Thank you so much! This is great!

Regards,

Richard!

1 like
bashy's avatar

@mstnorris Ah okay, my VM is never offline and I haven't tried to SSH into it right away :P

You may want to do && instead of ; so that it will only do the homestead ssh IF the previous command returns true.

homestead up && sleep 10 && homestead ssh
mstnorris's avatar

@bashy unless it fails it shouldn't return false, but I will take your advice. Can't hurt ;)

bashy's avatar

@mstnorris Well not directly but all commands return a status to the command line after it's finished. Some themes on ZSH have red/green response for that.

Please or to participate in this conversation.