Skip to content

Instantly share code, notes, and snippets.

@yookoala
Last active July 28, 2026 19:08
Show Gist options
  • Select an option

  • Save yookoala/818c1ff057e3d965980b7fd3bf8f77a6 to your computer and use it in GitHub Desktop.

Select an option

Save yookoala/818c1ff057e3d965980b7fd3bf8f77a6 to your computer and use it in GitHub Desktop.
udev rules to use Apple SuperDrive on Linux
#
# Apple SuperDrive initialization rule
#
# See: https://gist.github.com/yookoala/818c1ff057e3d965980b7fd3bf8f77a6
ACTION=="add", ATTRS{idProduct}=="1500", ATTRS{idVendor}=="05ac", DRIVERS=="usb", RUN+="/usr/bin/sg_raw --cmdset=1 %r/sr%n EA 00 00 00 00 00 01"

Device Rule for Apple SuperDrive

This is for properly using an Apple SuperDrive on Linux.

Why?

Although Linux can detect a SuperDrive being plugged in, the hardware won't do anything until receiving a specific set of Command Descriptor Block (CDB) through USB. If not, you cannot put disc in or take disc out even when the drive was connected correctly.

To use SuperDrive on Linux you can use Linux's SCSI Utilities (sg3_utils) to manually send the CDBs like this:

/usr/bin/sg_raw /dev/sr0 EA 00 00 00 00 00 01

But to do this manually everytime is simply a stupid task not to automate.

What the udev rule file does?

When installed properly into /etc/udev/rules.d, the udev rule file above (90-mac-superdrive.rules) will be triggered the sending of CDBs everytime the drive is plugged. It will even detect the correct device number if multiples are plugged.

Reference:

Prerequsities

Need to have sg3-utils installed on your system.

For Ubuntu:

sudo apt install sg3-utils

For Fedora / RHEL:

sudo dnf install sg3_utils

Installation

To create the file, you may use this command:

cat <<- EOF | sudo tee  /etc/udev/rules.d/90-mac-superdrive.rules > /dev/null
#
# Apple SuperDrive initialization rule
#
# See: https://gist.github.com/yookoala/818c1ff057e3d965980b7fd3bf8f77a6

ACTION=="add", ATTRS{idProduct}=="1500", ATTRS{idVendor}=="05ac", DRIVERS=="usb", RUN+="/usr/bin/sg_raw --cmdset=1 %r/sr%n EA 00 00 00 00 00 01"
EOF

After Installation

Things won't immediately work after the above setup. You'll need to reload the udev rules and replug the SuperDrive. And the simplest way to do both is to, well, reboot.

But if you want to be a cool user, then you may follow these steps without reboot:

  1. Reload udev rules
    udevadm control --reload-rules && udevadm trigger
    
  2. Unplug and replug the SuperDrive

Thing should now work.

@yookoala

yookoala commented Aug 4, 2024

Copy link
Copy Markdown
Author

@Quaker44: I'm no expert about this. Have you checked the device number of your device? It can be /dev/sr0, /dev/sr1 ... /dev/srX.

The udev rule here would detect the newly inserted device number correctly. But if you want to manually run the command, you might want to check.

@nassimabed

Copy link
Copy Markdown

It worked like a charm but only after a restart.

@jrswift1963

Copy link
Copy Markdown

I can’t believe this worked and just took a few steps. Thanks!

@rezarajan

Copy link
Copy Markdown

Thank you random person on the internet for solving my very niche problem!

@jbArchNovice

Copy link
Copy Markdown

Worked flawlessly on Asahi on a M1 MacBook Air. Thank you kindly.

@lightning2901

Copy link
Copy Markdown

Muchas gracias! :)

@SUPERTOHOREMIX

Copy link
Copy Markdown

Hello,

I have tried the commands above and have had no success. Think a huge part of the problem is I'm using Bazzite which historically has been very anal about things like this.
Is there a Bazzite version of the installation command by any chance?

Thank you.

@espressoaddict15324

Copy link
Copy Markdown

Tried this, it ate my CD and I can't get it to eject. I get NVMe Result=0x0 when manually doing it. Running the udev rule returns Permission denied. Running it as root does the same.
image
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment