Changing the VirtualBox Host Key under OS X

16 Apr 2014

VirtualBox (version 4.3.10) on OS X annoyed me by defining the left command key as its “host key”, which is used to make a running virtual machine release the keyboard. This means that VirtualBox gobbles up the key and doesn’t let me switch windows from a VM via Cmd-Tab. Of course, the host key can be changed via the Preferences dialog – except this setting is not saved and is reset to “Left Cmd” when you re-open the dialog. After some googling, I found that

VBoxManage getextradata global GUI/Input/HostKeyCombination

reads the current value of this option (the default value is 55 for the left command key). Similarly, the intuitive

VBoxManage setextradata global GUI/Input/HostKeyCombination 54

sets the host key to be the right command key. 61 is the right alt key, 60 right control, etc., as determined by the time-honored method of “educated guess”.