19

I am running Windows inside VirtualBox on Mac OSX. However, I am frequently copying and pasting/undoing etc using keyboard shortcuts.

Because Mac is dumb and tries to be different, common shortcuts such as ctrl+c and ctrl+v are cmd+c and cmd+v on Mac. This creates a problem because I keep trying to use mac-style shortcuts in the VM, or windows-style shortcuts on the Mac (my workflow is, do ASP.NET dev in the VM, but use the Mac hosts browser).

What I would like to be able to do is make VirtualBox send "Command" key presses as "Ctrl" to the VM, so that I dont have to keep remembering which environment I am in and thinking about which key combination I need to use.

Is this possible?

1 Answer 1

13

Because Mac is dumb and tries to be different, common shortcuts such as ctrl+c and ctrl+v are cmd+c and cmd+v on Mac.

Macs had copy and paste before Windows. Separating control and command means that you don't need additional keybindings for interrupting a process in a shell or going a page down in emacs.

Anyway, you can do that with KeyRemap4MacBook.

You could also save something like this as private.xml:

<?xml version="1.0"?>
<root>
<item>
<name>test</name>
<identifier>private.test</identifier>
<only>VIRTUALMACHINE</only>
<autogen>--KeyToKey-- KeyCode::Z, VK_COMMAND, KeyCode::Z, VK_CONTROL</autogen>
<autogen>--KeyToKey-- KeyCode::X, VK_COMMAND, KeyCode::X, VK_CONTROL</autogen>
<autogen>--KeyToKey-- KeyCode::C, VK_COMMAND, KeyCode::C, VK_CONTROL</autogen>
<autogen>--KeyToKey-- KeyCode::V, VK_COMMAND, KeyCode::V, VK_CONTROL</autogen>
<autogen>--KeyToKey-- KeyCode::A, VK_COMMAND, KeyCode::A, VK_CONTROL</autogen>
</item>
</root>

The test folder has an XML file with all the predefined remappings.

6
  • 2
    Thankyou for your answer. Does this software permanently reassign Command to Control? I only want the reassign to happen while the mouse is over the VirtualBox window (I run VirtualBox in 'auto capture host keyboard' mode). Oct 14, 2012 at 4:09
  • 1
    Excellent answer, It's preferable to do this on the Mac host rather than mucking w/ Windows registry settings per box. @ErinDrummond the highlighted line in the GUI states, "only in virtual machine"
    – Jack Frost
    Sep 18, 2014 at 17:44
  • Very useful. I --systematically-- get command and ctrl wrong when I switch from the mac to the VM, and back. Today the soft is called Karabiner. PS: How do we convince VirtualBoxVM's developpers to include this option in their program?
    – Arnaud
    Dec 11, 2015 at 10:26
  • 1
    As of July 2019, @DiegoDD's comment above appears no longer valid...Karabiner installs successfully on Sierra (and Mojave)
    – karfus
    Jul 20, 2019 at 21:43
  • 1
    0 That renamed app "Karabiner" appears to be actively maintained. It is hosted here karabiner-elements.pqrs.org and even says it already supports Apple Silicon and OS Big Sur.
    – ybull
    Feb 2, 2021 at 15:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .