When I restart terminal homestead will not work! Hey,
When I restart terminal the command homestead will not work?
Regards,
Richard.
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.
@mstnorris What is this command :D
homestead up; sleep 10; homestead ssh
Why the sleep?
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.
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.
Oh the command is just homestead.
Hey,
No, I don't understand how to add the homestead file to my path, the composer file worked fine.
Regards,
RIchard.
You don't add it to your path, you add an alias like I showed above to the command.
Hey,
Ah, I see. Thanks!
Regards,
Richard.
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.
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.
Hey,
I get the error message when I use sudo.
Regards,
Richard.
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
Firstly it is .bashrc
You create a file from the command line like so:
touch ~/.bashrc
Then you can edit it:
nano ~/.bashrc
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.
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
-bash: homestead: command not found```
PATH: bash: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin: No such file or directory
The aliases only work on the one terminal page, it looks like they are not being saved.
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.
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.
I have done that but it still keeps doing the same.
You need to restart your Terminal.
Hey,
It is still doing the same!
Regards,
Richard.
Can you paste the following
~/.bashrc
~/.bash_profile
$PATH
Sorry,
Forgot to add the export to my bash file. Thank you so much! This is great!
Regards,
Richard!
@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
@bashy unless it fails it shouldn't return false, but I will take your advice. Can't hurt ;)
@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 sign in or create an account to participate in this conversation.