Auto-starting VirtualBox VMs on OS X

sudo cp \
/Applications/ \

Then edit /Library/LaunchDaemons/org.virtualbox.vboxautostart.plist set Disabled to false, set KeepAlive to true, and confirm the last string entry in the command array is set to /etc/vbox/autostart.cfg. The file should look like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

Make the directory /etc/vbox and create the file /etc/vbox/autostart.cfg with the following content:

# Default policy is to "deny" starting a VM, the other option is "allow".
default_policy = deny

berto = {
allow = true

Make sure to change berto to the username on your system that the VMs are under.

Next properly set permissions:

sudo chmod +x /Applications/
sudo chown root:wheel /etc/vbox
sudo chown root:wheel /etc/vbox/autostart.cfg
sudo chown root:wheel /Library/LaunchDaemons/org.virtualbox.vboxautostart.plist

Now, configure the VMs that should automatically start and set how they should be stopped:

VBoxManage modifyvm jenkins --autostop-type acpishutdown
VBoxManage modifyvm chefpa-jenkins --autostart-enabled on

Finally, test the configuration by running:

sudo launchctl load /Library/LaunchDaemons/org.virtualbox.vboxautostart.plist

After a reboot, the VMs that have been set with autostart enabled should be running!

4 thoughts on “Auto-starting VirtualBox VMs on OS X”

  1. This is a super helpful post for me! Thanks so much!

    How would you stop and start the machine from once you’ve started it the first time? I want to make some changes, but it’s hard to when it auto-restarts right away!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s