Running VirtualBox From the Terminal

At Gimme Bar we have a magical development setup, courtesy of Sean Coates, which involves running local instances of our web app on Virtual Machines using VirtualBox. All my work can then be reached by launching any browser on my machine and visiting local.gimmebar.com. And, while this is great, it means I have a VM window open which I do not ever interact with. So, in order to simplify my life I knew I needed to find a way to run VirtualBox from the Terminal, without the GUI. Long story short, here are my findings:

Start VM

$ VBoxManage startvm "[NAME OF YOUR VM]" --type headless

Send Shutdown Signal

$ VBoxManage controlvm "[NAME OF YOUR VM]" acpipowerbutton

Power Off

$ VBoxManage controlvm "[NAME OF YOUR VM]" poweroff