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

jrdavidson's avatar

Homestead and SSH Keys

I am tired of the continuous issues with Mamp Pro and I am trying to set up Vagrant and Homestead on my IMac which has Yosemite installed currently.

I am following along in the Build Larabook From Scratch Series and watching the first video that talks about how to install both Vagrant and Homestead.

When I got to about the 2:04 point in the first video @JeffreyWay talks about SSH keys. I have a github account but its really been so long since I've done something with it that I just decided to just put in the following code as he says to do

ssh-keygen -t rsa -C "you@homestead"

So after doing so in my console this is what follows

Jeffreys-iMac:Personal jeffreydavidson$ ssh-keygen -t rsa -C "you@homestead"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/jeffreydavidson/.ssh/id_rsa):

At this point I am not sure what file to save the key to. Can someone explain to me what would be the best file to have it save the key to?

0 likes
34 replies
elpete's avatar

The file it has listed there (/Users/jeffreydavidson/.ssh/id_rsa) is the default location.

Then you want to reference whichever path you choose in your Homestead.yaml file.

authorize: ~/.ssh/id_rsa.pub

(In this case ~ is an alises for your home folder, which would expand to /Users/jeffreydavidson if that's who you are logged in as.)

2 likes
jrdavidson's avatar

@spardicurus I'm trying to understand what I should be entering in after the colon.

Are you saying after the colon I should put...

~/.ssh/id_rsa.pub
elpete's avatar

In generating the RSA key, I would just accept the defaults if I don't have a reason to do differently. You can save to the default location by just hitting Enter at that prompt.

1 like
jrdavidson's avatar

Thank you. However it says

/Users/jeffreydavidson/.ssh/id_rsa already exists.

Is this something I want to overwrite?

elpete's avatar

Your choice. It looks like you've generated one of these before. Homestead installs the ssh key provided in the authorize: parameter on your VM. And since the secret key is on your machine, you should be able to ssh in with no problems.

Make sure you are pointing to that key in your Homestead.yaml and try to ssh in using homestead up and homestead ssh. You should be fine then.

1 like
jrdavidson's avatar

@spardicurus I elected to overwrite the file and then following along @JeffreyWay says to open up the Homestead.yaml directory however it did not create one. I'm thinking this is a problem.

jrdavidson's avatar

@spardicurus I did a search of the file on my home directory and found the file. For some reason it is located here:

Macintosh HD ▸ Users ▸ jeffreydavidson ▸ Projects ▸ Personal ▸ Homestead ▸ src ▸ stubs

So I don't know if I need to move any files or how this happened.

elpete's avatar

Have you installed the laravel/homestead package through Composer? And did you run homestead init?

1 like
jrdavidson's avatar

@spardicurus I followed every line of the series video number 1. So everything up to that point I performed.

jrdavidson's avatar

@sitesense and @spardicurus I followed the instructions on the page that @sitesense provided and this is what is happening.

Last login: Tue Mar 24 14:53:38 on ttys000
Jeffreys-iMac:~ jeffreydavidson$ vagrant box add laravel/homestead
==> box: Loading metadata for box 'laravel/homestead'
    box: URL: https://atlas.hashicorp.com/laravel/homestead
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) virtualbox
2) vmware_desktop

Enter your choice: 1
==> box: Adding box 'laravel/homestead' (v0.2.5) for provider: virtualbox
The box you're attempting to add already exists. Remove it before
adding it again or add it with the `--force` flag.

Name: laravel/homestead
Provider: virtualbox
Jeffreys-iMac:~ jeffreydavidson$ composer global require "laravel/homestead=~2.0"
Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.
Changed current directory to /Users/jeffreydavidson/.composer
Warning: This development build of composer is over 30 days old. It is recommended to update it by running "/usr/local/bin/composer self-update" to get the latest version.
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing symfony/process (v2.6.5)
    Downloading: 100%

  - Installing laravel/homestead (v2.0.14)
    Downloading: 100%

Writing lock file
Generating autoload files
Jeffreys-iMac:~ jeffreydavidson$ homestead init
Creating Homestead.yaml file... ✔
Homestead.yaml file created at: /Users/jeffreydavidson/.homestead/Homestead.yaml
Jeffreys-iMac:~ jeffreydavidson$ homestead edit
Jeffreys-iMac:~ jeffreydavidson$ homestead edit
Jeffreys-iMac:~ jeffreydavidson$ homestead edit
Jeffreys-iMac:~ jeffreydavidson$ ssh-keygen -t rsa -C "you@homestead"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/jeffreydavidson/.ssh/id_rsa):
/Users/jeffreydavidson/.ssh/id_rsa already exists.
Overwrite (y/n)?
Jeffreys-iMac:~ jeffreydavidson$ ssh-keygen -t rsa -C "you@homestead"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/jeffreydavidson/.ssh/id_rsa):
/Users/jeffreydavidson/.ssh/id_rsa already exists.
Overwrite (y/n)? yes
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/jeffreydavidson/.ssh/id_rsa.
Your public key has been saved in /Users/jeffreydavidson/.ssh/id_rsa.pub.
The key fingerprint is:
f7:cd:7d:a9:67:64:0e:5c:45:0d:48:4c:94:ce:61:71 you@homestead
The key's randomart image is:
+--[ RSA 2048]----+
|           ==+Eoo|
|            *.  o|
|           + .  .|
|            o  . |
|        S . . .  |
|         . . = +.|
|            . B.o|
|              .+.|
|             .o  |
+-----------------+
Jeffreys-iMac:~ jeffreydavidson$ cd Homestead
-bash: cd: Homestead: No such file or directory
Jeffreys-iMac:~ jeffreydavidson$
bashy's avatar

You can specify a different key name, doesn't have to be id_rsa.

That all looks fine anyway? What's the problem?

jrdavidson's avatar

the problem is if you notice i tried to do the cd command on Homestead and it says no such file or directory.

bashy's avatar

cd .homestead?

Why do you need to go in there?

jrdavidson's avatar

So I can update my sites and shared folders as directed in the first video of the series that I listed in my original post.

jrdavidson's avatar

If I do that it opens up Coda which I don't want it to do. I prefer phpStorm and even when it opens the file it shows nothing in there inside of the jeffreydavidson->.homestead->Homestead.yaml file.

jrdavidson's avatar

Yes but atleast that's what happens when I try and it opens in Coda which I don't like.

jrdavidson's avatar

Or is this something that would be better deleted and started over in the process?

bashy's avatar

Sounds like something went wrong as it creates the file with the default stuff in?

Have you tried opening the file manually?

Jeffreys-iMac:~ jeffreydavidson$ homestead init
Creating Homestead.yaml file... ✔
Homestead.yaml file created at: /Users/jeffreydavidson/.homestead/Homestead.yaml
jrdavidson's avatar

Well I tried going through the finder but it keeps trying to load the file with Coda and it for some reason is showing as a hidden directory.

bashy's avatar

Dot directories are hidden by default in OS X.

Just open it with something else. You can open the folder for homestead like this in terminal

cd ~/.homestead && open .

Then right click, open with fav editor

1 like
jrdavidson's avatar

@bashy Great so far so good but to make sure the authorize key should NOT be this correct.

authorize: ~/.ssh/id_rsa.pub
bashy's avatar

That's the default public key for auth in SSH. I'm not sure what you've got setup but that's the normal file.

1 like
jrdavidson's avatar

Should I not be concerned with the fact that @JeffreyWay has his set to this:

authorize:  /Users/jeffreyway/.ssh/id_rsa.pub

If this is the way it should be then I obviously know I'd replace his name with mine.

bashy's avatar

Well, little trick... ~ symbol is the path to your home directory. Doing /Users/Username/ is the same.

Try this and see

echo ~

// example
┌[bashy☮Lyra]-(~)
└> echo ~/.ssh
/Users/bashy/.ssh
1 like
jrdavidson's avatar

One last thing. In the video its saying I need to cd into the Homestead directory and then run vagrant up but is there an easier way since its not letting me do it because its got the . notation.

bashy's avatar

I don't personally use Homestead but I've not watched the video in a while and I can't remember what you have to do.

Isn't it just homestead up from anywhere in terminal?

Next

Please or to participate in this conversation.