Mac OS X: Turn regular F-keys into media keys

9,698

Solution 1

Download the following script: http://gskinner.com/blog/assets/MediaControlScripts.zip

Then simply follow these instructions:

  1. Double-click on each of the script files for the commands you want to install, and click the "Install" button in the dialog

  2. Go to System Preferences > Keyboard > Keyboard Shortcuts

  3. Select Services in the left panel, then scroll down to the script you want to assign a shortcut to

  4. Double-click on the right side of the row to edit the shortcut

  5. Hit the key combination you want to use, and make sure the checkbox to the left is checked (it likes to uncheck when you edit the key combo)

enter image description here

Ref: http://blog.gskinner.com/archives/2011/10/media-keys-in-osx-for-any-keyboard.html

Solution 2

Install Karabiner and save a file like this as ~/Library/Application Support/Karabiner/private.xml:

<?xml version="1.0"?>
<root>
  <item>
    <name>ctrl+f-keys to media keys</name>
    <identifier>mediakeys</identifier>
    <autogen>__KeyToKey__ KeyCode::F1, VK_CONTROL | ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_BRIGHTNESS_DOWN</autogen>
    <autogen>__KeyToKey__ KeyCode::F2, VK_CONTROL | ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_BRIGHTNESS_UP</autogen>
    <autogen>__KeyToKey__ KeyCode::F8, VK_CONTROL | ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_MUSIC_PREV</autogen>
    <autogen>__KeyToKey__ KeyCode::F9, VK_CONTROL | ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_MUSIC_PLAY</autogen>
    <autogen>__KeyToKey__ KeyCode::F10, VK_CONTROL | ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_MUSIC_NEXT</autogen>
    <autogen>__KeyToKey__ KeyCode::F11, VK_CONTROL | ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_VOLUME_DOWN, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L</autogen>
    <autogen>__KeyToKey__ KeyCode::F12, VK_CONTROL | ModifierFlag::NONE, KeyCode::VK_CONSUMERKEY_VOLUME_UP, ModifierFlag::OPTION_L | ModifierFlag::SHIFT_L</autogen>
  </item>
</root>

Then open the Karabiner application, press the ReloadXML button, and enable the setting.

You can also use the GUI to configure it like this:

Karabiner

Karabiner has a few options for which set of F keys you want to use, so take a look at their options to see what suits you best.

Share:
9,698
Ingwie Phoenix
Author by

Ingwie Phoenix

Updated on September 18, 2022

Comments

  • Ingwie Phoenix
    Ingwie Phoenix over 1 year

    I recently bought a regular keyboard for my MacBook to complete my stationary DJ set. But when I did, I didn't find a way to remap the F[1-12] keys to media keys.

    Basically, what I am looking for is, the ability to make F1, for instance, pause iTunes. Of course, I'd also want to turn other F-keys into media keys to rewind and skip thru my iTunes, as I found this very convenient.

    Is there a tool or way that enables me to do that? I am on 10.9.

  • Ingwie Phoenix
    Ingwie Phoenix over 9 years
    A very nice solution! That is very native and works just as I want. Thanks!
  • Ingwie Phoenix
    Ingwie Phoenix over 9 years
    I found Karabiner after a while, but its a bit odd to configure - so I went with the second solution. But its a great software nevertheless!
  • Matt M.
    Matt M. about 5 years
    Not a great solution. It only works with iTunes, not as global Media Keys.
  • Mohammad_Hosseini
    Mohammad_Hosseini about 4 years
    @DarkEvE How to make the global media keys?