Skip to content

Instantly share code, notes, and snippets.

@danielcheasman
Forked from reidransom/gist:6042016
Last active September 24, 2018 22:00
Show Gist options
  • Select an option

  • Save danielcheasman/c468c0eab73ab02506978b63f4f682b8 to your computer and use it in GitHub Desktop.

Select an option

Save danielcheasman/c468c0eab73ab02506978b63f4f682b8 to your computer and use it in GitHub Desktop.

Revisions

  1. danielcheasman revised this gist Jul 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -14,7 +14,7 @@ Copy the Virtualbox autostart plist template file to your system's LaunchDaemons
    /Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist \
    /Library/LaunchDaemons

    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:
    Then edit `/Library/LaunchDaemons/org.virtualbox.vboxautostart.plist`. The file should look like this:

    <?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">
  2. danielcheasman revised this gist Jul 4, 2017. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,7 @@ _Ameded and tested on Mac OS 10.12 / VirtualBox 5.1.22_
    After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

    [Link to original gist.](https://gist.github.com/reidransom/6042016)

    [Link to original article.](http://rcaguilar.wordpress.com/2013/01/07/auto-starting-virtualbox-vms-on-os-x/)

    Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.
  3. danielcheasman revised this gist Jul 4, 2017. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ _Ameded and tested on Mac OS 10.12 / VirtualBox 5.1.22_

    After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

    [Link to original gist.] (https://gist.github.com/reidransom/6042016)
    [Link to original gist.](https://gist.github.com/reidransom/6042016)
    [Link to original article.](http://rcaguilar.wordpress.com/2013/01/07/auto-starting-virtualbox-vms-on-os-x/)

    Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.
  4. danielcheasman revised this gist Jul 4, 2017. 1 changed file with 3 additions and 0 deletions.
    3 changes: 3 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,10 @@
    # Auto-starting VirtualBox VMs on OS X

    _Ameded and tested on Mac OS 10.12 / VirtualBox 5.1.22_

    After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

    [Link to original gist.] (https://gist.github.com/reidransom/6042016)
    [Link to original article.](http://rcaguilar.wordpress.com/2013/01/07/auto-starting-virtualbox-vms-on-os-x/)

    Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.
  5. danielcheasman revised this gist Jul 4, 2017. 1 changed file with 13 additions and 12 deletions.
    25 changes: 13 additions & 12 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -16,18 +16,19 @@ Then edit `/Library/LaunchDaemons/org.virtualbox.vboxautostart.plist` set `Disab
    <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Disabled</key>
    <false/>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>org.virtualbox.vboxautostart</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string>
    <string>--start</string>
    <string>/etc/vbox/autostart.cfg</string>
    </array>
    <key>Disabled</key>
    <false/>
    <key>Label</key>
    <string>org.virtualbox.vboxautostart</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string>
    <string>/etc/vbox/autostart.cfg</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>LaunchOnlyOnce</key>
    <true/>
    </dict>
    </plist>

  6. @reidransom reidransom created this gist Jul 19, 2013.
    67 changes: 67 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    # Auto-starting VirtualBox VMs on OS X

    After finding a lot of other posts on the topic that didn't work out for me this one did the trick so I'm reposting for my own sense of self preservation.

    [Link to original article.](http://rcaguilar.wordpress.com/2013/01/07/auto-starting-virtualbox-vms-on-os-x/)

    Copy the Virtualbox autostart plist template file to your system's LaunchDaemons folder.

    sudo cp \
    /Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist \
    /Library/LaunchDaemons

    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" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
    <plist version="1.0">
    <dict>
    <key>Disabled</key>
    <false/>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>org.virtualbox.vboxautostart</string>
    <key>ProgramArguments</key>
    <array>
    <string>/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh</string>
    <string>--start</string>
    <string>/etc/vbox/autostart.cfg</string>
    </array>
    </dict>
    </plist>

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

    default_policy = deny
    osxusername = {
    allow = true
    }

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

    Next properly set permissions:

    sudo chmod +x /Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh
    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 vmname --autostart-enabled on
    VBoxManage modifyvm vmname --autostop-type acpishutdown

    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!

    ### References

    <https://www.virtualbox.org/manual/ch09.html#autostart-osx>

    <https://forums.virtualbox.org/viewtopic.php?f=8&t=51593&start=15#p240724>

    <https://forums.virtualbox.org/viewtopic.php?f=11&t=51529#p236492>