Skip to content
A small headless Cocoa App, which responds to the MediaKeys on Apple Wireless keyboards.
Find file
Latest commit 356934f @dreamcat4 Add audio_output section "osx" audio output plugin
This speeds up mpd loading, by skipping the audio autodect bit



A small headless Cocoa App, which responds to the MediaKeys on Apple Wireless keyboards.


  • This app directly calls Shell commands for macports mpd / mpc (Music Player Daemon)

  • You may change these commands to call your own preferred music player / media player.

  • Supports 10.6+ (Snow Leopard) or later only. But you can make support for 10.4-10.5.

  • Sudo isnt needed if can avoid /usr/bin/sudo /opt/local/bin/port load mpd

The XCodeProject builds a number of app bundles.

  • MediaKeys is the persistent one which you should put in your StartupItems.

  • The other variants eg MediaKeysPause can be executed on a 1 time bases. Those ones each just perform 1 specific operation and then exit immediately. Useful for hooking up the same functionality to another program, eg RemoteBuddy behaviour or Aurora.

MPD Configuration

# 1. Passwordless sudo (needed for starting the mpd daemon)

# 2. install macports

# 3. install mpd
sudo port install mpd
sudo port install mpc

# 4. Edit the sample mpd.conf and point to your iTunes library
mate MediaKeys/mpd.conf
sudo cp -f MediaKeys/mpd.conf /opt/local/etc/mpd.conf

# 5. Initialize mpd database
cp MediaKeys/mpd.conf /opt/local/etc/mpd.conf
mpd --create-db --stdout /opt/local/etc/mpd.conf

# Start the mpd Server
sudo port load mpd

# 6. Write a playlist named "all shuffle"
mpc ls | mpc add
mpc shuffle
mpc save "all shuffle"


Other issues (recommended to read)

  • Before using MediaKeys you should rename the BundleIdentifier string in the iTunes package. (the BundleIdentifier is stored in the info.plist). This is a workaround because iTunes will launch whenever you hit the Play/Pause key. This will disable the use of the special media keys in iTunes.

  • There are the Bundle Identifiers for various other popular Music Players / Media Players. These are used for an "ignore list". Its likely that some other apps which also respond to the media keys aren't listed there. Add the relevant Bundle Ids to the list and re-compile. In case of problem, fire up the XCode Debugger to see whats happening.

  • Its not really known yet how to block or intercept these media key events higher up in the AppKit / windowserver level. Certain keys (like volume up, volume down, and Expose key) will open a System Preferences Pane, or do other things when used in conjunction with a modifier key. You may try the iTunes trick again here and rename the relevant bundle identifiers.

  • has LSUIElement == true, they are not visible in the User Interface. Just ps -ax | grep MediaKeys to get the PID # or killall -9 MediaKeys to quit.


Copyright (c) 2010 dreamcat4

Something went wrong with that request. Please try again.