Skip to content

Instantly share code, notes, and snippets.

@yuntaek
Forked from reidransom/gist:6042016
Last active January 6, 2016 01:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yuntaek/c9c3092ac362833258a0 to your computer and use it in GitHub Desktop.
Save yuntaek/c9c3092ac362833258a0 to your computer and use it in GitHub Desktop.
Auto-starting VirtualBox VMs on OS X

MAC 에서 VituralBox VM 인스턴스 자동실행

영어로 된 문서를 한글로 번역한 문서입니다. 자동실행 필요한 부분만 번역하였습니다.

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.

원본 내용 출처

Virtualbox의 autostart plist template file을 LaunchDaemons 폴더에 복사한다.

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

/Library/LaunchDaemons/org.virtualbox.vboxautostart.plistDisabled 항목을 false로 설정한다. KeepAlive 항목을 true로 설정한다. 마지막으로 마지막 항목의 command array가 /etc/vbox/autostart.cfg 설정되어 있는지 확인한다. 수정된 파일은 아래와 같다.

<?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> <!-- 이 부분은 Vitual box 버전에 따라 생략될 수 있습니다. -->
<string>/etc/vbox/autostart.cfg</string>
</array>
</dict>
</plist>

/etc/vbox 폴더를 생성하고, /etc/vbox/autostart.cfg 파일을 아래의 내용을 포함해서 생성한다.

default_policy = deny
osX사용자이름 = {
allow = true
}

VMs이 실행되는데 사용되는 Mac의 사용자계정을 입력한다.

다음으로 각 파일에 대한 권한 알맞게 아래와 같이 설정한다.

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

VM 인스턴스가 자동으로 실행 되었는지와 어떻게 자동으로 종료될지를 설정한다.

VBoxManage modifyvm vmname --autostart-enabled on
VBoxManage modifyvm vmname --autostop-type acpishutdown

마지막으로 configuration을 실행함으로 확인한다.

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

재시작후, autostart를 설정한 VM 인스턴스들이 자동으로 실행되어 있을 것이다.

참조

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment