Homestead, But on FreeBSD

Developing Laravel Applications on a FreeBSD Vagrant Box

Caleb Marble


What is this?

This is the installation guide for my custom development environment for Laravel applications on FreeBSD. The resulting Vagrant box has the following features:

If that sounds appealing to you keep reading. In the examples below I have three default "applications" that will be used as stand-ins for your application.

Tested operating systems:

Installation Instructions

  1. You'll want to install the following on your system:
  1. Clone this repository (same for Windows provided you have git. Otherwise download the zip file from the releases page and extract it wherever you please):
git clone ""
cd Homestead-on-FreeBSD
  1. Copy the Vagrant.yaml file to it's proper location and modify it to suit your needs:
cp Vagrant.yaml ~/.config/Vagrant.yaml
$EDITOR ~/.config/Vagrant.yaml

Windows users do the following:

cd %HOMEDRIVE%%HOMEPATH%\path\to\the\folder\Homestead-on-FreeBSD
mkdir %HOMEDRIVE%%HOMEPATH%\.config
copy Vagrant-Windows.yaml %HOMEDRIVE%%HOMEPATH%\.config\Vagrant.yaml
notepad.exe %HOMEDRIVE%%HOMEPATH%\.config\Vagrant.yaml
While I did keep the .yaml options as close as possible to the official Homestead release, only a subset of the options available were implemented.
  1. OPTIONAL: Make sure you have a ssh key in ~/.ssh/id_rsa.
  2. Change anything you need in the Config/Includes folder. This is a list of apache24 config files that will be added to new box. You can add any modules you might need to Config/Includes/global.conf. I've included example configuration files for both a-simple-blog and cool-crm applications that has a separate Laravel application for the admin side.
This must be done before the initial `vagrant up`. If you have already initialized the environment you'll need to run `vagrant provision` in order for your changes to be reflected.
Windows users: The first time you run vagrant up Vagrant will complain that FreeBSD doesn't have the capability to mount SMB shares. I have worked around this for the time being in the Vagrantfile. You can safely ignore this and manually run vagrant provision after the first vagrant up.

Host Machine Changes

There are a number of changes you should consider making to your host machine to make life a bit more tolerable.

  1. Modify /etc/hosts (C:\Windows\System32\Drivers\etc\hosts for Windows) to include the hostnames of your application(s). This should be the same hostnames you set for the Config/Includes/*.conf files. To continue with the example applications here is what the hosts file should contain:
You'll notice I didn't add That's because it's going to piggy-back off the hostname, much like a real-world application would.
  1. Note for Mac OS users: Consider adding the following commands to your sudoers file. This will allow you to run vagrant up multiple times without entering your users password. Run sudo visudo and append the following to the end of the file:
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports
Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart
Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports

See the Vagrant docs for more information.

This requires that you be apart of the admin group. You can check which groups you belong to with this command: `dscl . search /Groups GroupMembership $(whoami)`.
If you are not apart of the admin group you can change the last line to say `%AGroupYouBelongTo` instead of `%admin`.

Start 'er Up

  1. Run vagrant up (should take ~15 minutes)
  2. Run vagrant reload (should take ~1 minute).
  3. Double check /etc/exports (Network > MachineName on Windows) to make sure that Vagrant properly created the shares you declared in ~/.config/Vagrant.yaml.

  4. You should now be able to connect to any SQL databases you've setup in the ~/.config/Vagrant.yaml file. Point your favorite SQL application at with the username and password you setup and you should be able to connect and restore from a backup.

  5. Clear up any composer mischief. Get into your new box with vagrant ssh. You'll see that you have your projects waiting for you in the $HOME directory. Run the following commands to help clear out any cached objects.

vagrant ssh
cd cool-crm
composer install
php artisan clear-compiled
php artisan optimize

Repeat the above for each project directory you have. I have also included npm, grunt, and scss-lint in the box for you to be able to build your static assets.

You should now be able to reach,, and from a browser. For this example I just had all project folders include a simple index.php file containing only phpinfo();.

tree Projects/
├── a-simple-blog
│   └── public
│       └── index.php
├── cool-crm
│   └── public
│       └── index.php
└── cool-crm-admin
    └── public
        └── index.php

But Wait, There's More!

If you would like to take a closer look at the Vagrantfile I go through it line by line in another post here: Homestead but on FreeBSD - A Closer Look

View Comments | Back to Blog | Back to Home