Auto-Launch Virtualbox VM at Login

Get list of VM’s on your machine

This command will list all of the VMs registered on your machine:

VBoxManage list vms

Example Output:

"vagrant_default_1470690945724_43235" {bcbb00cd-d427-4eac-829e-110941a96e1e}

"CentOS 7" {3c4e9624-1503-4577-9a6f-fd225febb311}

"Ubuntu_default_1474407668461_1068" {68640da7-8a53-4836-b241-c43547522043}

"Akomi v2.5" {368413ac-5b1f-4416-bc64-2c71b15c9074}

"default_1477497452794_77827" {e68656a9-dd85-4433-9d1e-1071dda99490}

Command to start VM:

VBoxManage startvm <UUID>

For example, to start the Akomi v2.5 VM, you would run:

VBoxManage startvm 368413ac-5b1f-4416-bc64-2c71b15c9074

Update and install LaunchAgent

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

<plist version="1.0">

<dict>

<key>Label</key>

<string>com.northshore.akomi-vm</string>

<key>LaunchOnlyOnce</key>

<true/>

<key>ProgramArguments</key>

<array>

<string>/usr/local/bin/VBoxManage</string>

<string>startvm</string>

<string>368413ac-5b1f-4416-bc64-2c71b15c9074</string>

</array>

<key>RunAtLoad</key>

<true/>

</dict>

</plist>