Setting up Laravel Homestead on Windows with Vagrant and VirtualBox

Jan 18, 2017 - 4 min read

Vagrant and Homestead are here to make our lives easier by offering a prepackaged virtual machine with all dependencies required by Laravel. If you are reading this, you probably tried to follow the official guide, but all you got is a timeout when accessing This article will help you set up the default configuration. Tested with Git 2.11.0, Vagrant 1.9.1, VBox 5.1.12, Homestead base image 1.0.1, Homestead 4.0.0, and Windows 7 x64.


Note: If you opt-out from adding optional Unix tools to your environment during Git installation, you will have to use Git Bash instead of Windows cmd (command prompt). After installation, log out or restart your PC so the changes to you PATH become effective.

In a nutshell

  1. Add to end of C:\Windows\System32\drivers\etc\hosts file
  2. Create directory structure: C:\Users\[Username]\Code\Laravel\public and create index.php file with any content
  3. Open command prompt of your choice
  4. Generate ssh public key (use defaults by pressing enter): ssh-keygen -t rsa -C ""
  5. Download Homestead base image (~1GB): vagrant box add laravel/homestead
  6. Navigate to C:\Users\[Username]: cd %USERPROFILE%
  7. Clone Homstead settings: git clone Homestead
  8. Navigate to Homestead directory cd Homestead
  9. Start Homestead VM: vagrant up
  10. Open your browser and go to

Tip: To open Windows cmd (command prompt) in any directory, hold SHIFT and right-click on empty space anywhere in directory. Select Open command window here from the extended menu.

Useful vagrant commands

# C:\Users\[Username]\Homestead

vagrant up		# Start VM (will download/create image)
vagrant halt		# Stop VM
vagrant provision	# Update VM settings based on Homestead.yaml while VM is running
vagrant destroy		# Delete VM

Common issues

Running in wrong directory

>> vagrant up
A Vagrant environment or target machine is required to run this command.
Run `vagrant init` to create a new Vagrant environment.
Or, get an ID of a target machine from `vagrant global-status` to run this command on.
A final option is to change to a directory with a Vagrantfile and to try again.

Solution: Make sure you are in your Homestead directory. Navigate to C:\Users\[Username] with cd %USERPROFILE%, and clone the Homstead settings with git clone Homestead. Navigate to Homestead directory using cd Homestead and run vagrant up.

Initialize Homestead

# C:\Users\[Username]\Homestead

>> vagrant up
C:/Users/[Username]/Homestead/scripts/homestead.rb:4:in 'configure':
undefined method '[]' for nil:NilClass (NoMethodError) from
C:/Users/[Username]/Homestead/Vagrantfile:33:in 'block in <top (required)>'

Solution: Navigate to C:\Users\[Username]\Homestead and run init.bat or to initialize Homestead and automatically create C:\Users\[Username]\.homestead.

Missing SSH public key

# C:\Users\[Username]\Homestead

>> vagrant up
C:/Users/[Username]/Homestead/scripts/homestead.rb:117:in `read':
No such file or directory @ rb_sysopen - C:/Users/[Username]/.ssh/id_rsa (Errno::ENOENT)

Solution: Run ssh-keygen -t rsa -C "" anywhere to generate you public key in C:\Users\[Username]\.ssh\

Missing Code directory

>> vagrant up
* The host path of the shared folder is missing: ~/Code

Solution: Create directory structure: C:\Users\[Username]\Code\Laravel\public and create index.php file with any content.

Missing hosts entry

This site on the company, organization or school intranet has the same URL as an external website.

Solution: Add to end of C:\Windows\System32\drivers\etc\hosts. To make sure you changes are immediately effective, run ipconfig /flushdns command.

Vagrant Homestead VM not started took too long to respond.

Solution: Navigate to C:\Users\[Username]\Homestead and run vagrant up

Missing directory structure

No input file specified.

Solution: Create directory structure: C:\Users\[Username]\Code\Laravel\public

Missing index.php

403 Forbidden

Solution: Create index.php with any contents in C:\Users\[Username]\Code\Laravel\public