在Mac上自动启动VirutalBox中的虚拟机 (Auto start VirtualBox VM in mac OSX)

 Auto start VM in mac OSX(10.15)

    1. Install VirtualBox(6.1.4)
    
    2. Copy file "/Applications/VirtualBox.app/Contents/MacOS/org.virtualbox.vboxautostart.plist" to "/Library/LaunchDaemons"
    
    3. Edit the file "/Library/LanchDaemons/org.virtualbox.vboxautostart.plist"
       before

<key>Disabled</key> 

        after:

<key>Enabled</key>

   
    4. Create one file /etc/vbox/autostart.cfg with following content
      

    # Default policy is to deny starting a VM, the other option is "allow".
    default_policy = allow
    # Create an entry for each user allowed to run autostart
    myuserid = {
    allow = true
    }

    5. Open the term and execute

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

VBoxManage modifyvm "<vmname>" –autostart-enabled on VBoxManage modifyvm "<vmname>" --autostop-type acpishutdown

    6. Restart the mac then open virtualbox GUI to verify


Debug:
    if any error, use the command in plist file(like below) to debug

/Applications/VirtualBox.app/Contents/MacOS/VBoxAutostartDarwin.sh /etc/vbox

猜你喜欢

转载自www.cnblogs.com/xxzpjzy/p/12557887.html