I have a Das Keyboard for Mac that includes an eject key just to the right of the backspace key and to the left of the home key. I never need to use it, and it accidentally press it constantly which causes my CD tray to open. It's really annoying.

Is there anyway to disable this key?

If there's a way to keep the key's other functionality that's accessed by holding various modifiers (for example controlshifteject to put the display to sleep) that would be great. However if there only method disables the key entirely, I'm okay with that.

Note that I'm using Sierra so using Karabiner is not an option.

  • 2
    Are you using a Mac Pro? I can't think of another CD tray Mac that support Sierra.
    – JMY1000
    Commented Jun 9, 2017 at 5:05
  • @JMY1000 Indeed I am
    – Bri Bri
    Commented Jun 9, 2017 at 5:14
  • Pull the key out?
    – minseong
    Commented Sep 13, 2017 at 17:43

5 Answers 5


I created an app, PowerKey, that allows you to remap the Power and Eject keys on Mac keyboards.

Pick a key replacement such as Forward Delete, or use No Action to disable the key entirely.

You can also launch Apple Scripts or bash scripts via the key.

PowerKey app icon


remap options


  • 1
    This works great, and allowed me to run a script when the Eject key was pressed, which now locks to my screensaver instead of disabling all my monitors - sweet!
    – Brad Parks
    Commented Dec 17, 2019 at 15:05

I actually had Karabiner Elements working great with Sierra on my older Mac Pro - until a recent OS update. I assigned the F6 key to "eject", and that disabled the regular "eject" key. Karabiner also had a recent update (a couple days ago) that appeared to default all my keyboard mods back to standard Apple. Went back to an earlier version in backup, and it didn't fix the problem. Now, I still assign the F6 to "Eject" (and it works fine there), but the "Eject" button is no longer disabled. Did a lot of searching on the net and it seems that Apple has us on this one for now. At this point, I might try making a cover that fits over that corner, so when I accidentally hit the key, it doesn't work.

This is my lo-tech solution.enter image description here


Karabiner-Elements has been updated and allows me to disable the eject key on macOs 10.13.6 - High Sierra without issue: https://pqrs.org/osx/karabiner/index.html

Screenshot of the simple modification


I ended up writing a custom application to filter out eject key presses. It uses an event tap to do so. Here's a minimally working example that demonstrates how to do it:

#include <stdio.h>
#include <ApplicationServices/ApplicationServices.h>

static CFMachPortRef machPortRef = NULL;

CGEventRef specialKeyEventTapCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void *refcon)
    if (type == kCGEventTapDisabledByTimeout) {
        CGEventTapEnable(machPortRef, true);
        return event;

    uint64_t subtype = CGEventGetIntegerValueField(event, 99);

    if (subtype == 8) {
        static CGEventFlags allModifiers = (kCGEventFlagMaskShift | kCGEventFlagMaskControl | kCGEventFlagMaskAlternate | kCGEventFlagMaskCommand);
        int keycode = ((CGEventGetIntegerValueField(event, 149) & 0xFFFF0000) >> 16);
        CGEventFlags flags = CGEventGetFlags(event);

        if (keycode == NX_KEYTYPE_EJECT && (flags & allModifiers) == 0) {
            // filter eject key when no modifiers are pressed
            return NULL;

    return event;

int main()
    CFRunLoopSourceRef eventSrc = NULL;

    machPortRef =  CGEventTapCreate(kCGHIDEventTap, kCGHeadInsertEventTap, kCGEventTapOptionDefault, CGEventMaskBit(NX_SYSDEFINED), (CGEventTapCallBack)specialKeyEventTapCallback, NULL);

    if (machPortRef == NULL) {
        fprintf(stderr, "CGEventTapCreate failed!\n");
        return 1;

    eventSrc = CFMachPortCreateRunLoopSource(NULL, machPortRef, 0);
    CFRunLoopAddSource(CFRunLoopGetCurrent(), eventSrc, kCFRunLoopDefaultMode);



While you say "Note that I'm using Sierra so using Karabiner is not an option." you will find that Karabiner Elements, which does run in Sierra, will do what you want.

  • 3
    Unfortunately their GitHub page has the following note: "Karabiner-Elements cannot modify eject key due to the limitation of macOS API." So it looks like it cannot do what I want. :-(
    – Bri Bri
    Commented Jun 9, 2017 at 0:25

You must log in to answer this question.

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