Laravel logo

Install Laravel Homestead step by step

There are a few tutorials around about using Laravel Homestead but none I could find with up-to-date instructions. So I have decided to make my own.

A great place to start is the official Laravel Homestead guide

You will need to install Virtual Box and Vagrant. This is the base for your new environment.

CD into a directory where you would like to keep your projects. For me its one directory outside of my sites.

-- vagrant
--- projects
---- site 1
---- site 2

Install Homestead

Homestead is actually installed in~/.homestead and not in a visible directory.

In your terminal you will need to run:

composer global require "laravel/homestead=~2.0"

From here you will need to “place the ~/.composer/vendor/bin directory in your PATH so that homestead is executible”. To do this is actually very straight forward.

If your on a mac run:

sudo nano /etc/paths

This will open up your PATH’s file. You might already have a few things in here, just add ~/.composer/vendor/bin at the bottom and exit & save with ctrl + x

You will need to reload the PATH file so your changes can take affect.

Enter the following:

. ./.profile echo $PATH

cd will take you back to your / directory and . ./.profile echo $PATH will refresh your PATH file.

You can now enter:

homestead init

This will create a homestead.yaml file in ~/.homestead


To edit this file you can run:

homestead edit

The yaml file contains configuration data on your homestead sites.

You will need to set your SSH key. To do this run:

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

where USER is your username

Once you have your key you will need to replace the section in the YAML file. You should have something like this.

authorize: /Users/USER/.ssh/

- /Users/USER/.ssh/id_rsa

Next we need to map our folders correctly. So given my projects are all sitting in Users/USER/vagrant/projects my folder YAML looks like:

- map: /Users/USER/vagrant/projects
to: /home/vagrant/projects

Where “vagrant/projects” are the same directories but referenced above differently.

Time to map our site.

For development I like to use .local as my TLD this way I don’t get confused, but its up to you what you choose.

In the YAML file under “sites:” change the name you would like to use as a reference and change the location of the public facing files.

- map: mysite.local
to: /home/vagrant/projects/mysite/html

Save your YAML file and run:

homestead up

This might take a little while to download all the components.

Once its done you can visit your site by going to the IP address from your YAML file “”. If you don’t get any results make sure you have something in your html directory you defined earlier.

Update your hosts file

This will let you view your site at mysite.local

sudo nano /etc/hosts

Add the IP address “” to the hosts file at the bottom. For example mine is: mysite.local

Save and exist with ctrl + x and visit http://mysite.local

So ssh into your box run:

homestead ssh

From here you can navigate to your site directory and install Laravel 4 as normal.


If your wondering about database connections you can use the following

User: homestead
Password: secret
Port: 33060

Personally I like to use Sequel Pro to view my databases on my Mac.

And that’s it, your done! Congratulations you have now installed Laravel Homestead.


To suspend your machine so you can re-use it you will need to exit homstead via:


then run:

vagrant suspend

to re-load, just run:

vagrant up



Useful commands for Docker

A short little list of commands I have found myself using for Docker.

To console into a running container

docker exec -it d799b74e3289 /bin/bash

To view containers

docker ps

docker ps -a (view all containers)

To build a new image

docker build -it -p 80:80 imagename:0.1 (where 0.1 is the tag)

Display images

docker images

Remove images

docker rmi xxxxxxx (xxxxxxx is the image name)