Prevent CD and DVD disks from becoming stuck

Dec 14, '05 05:55:00AM

Contributed by: masterluc

There has been written a lot about one issue: CDs an DVDs have a tendency to get stuck in the drive at times. Most hints suggest a reboot for remedy. This was unacceptable to me.

After some research, I discovered that the disks only get stuck when the 'Put the disk(s) to sleep when possible' option is activated in the Energy Saver settings. There is only one setting for all drives, so if you actually want your external disks to sleep, you are "stuck." But what if you could you prevent your Superdrive from sleeping, and still have all other disks take their nap?

The solution: Employ /usr/bin/drutil via launchd. You will only need TextEdit and Terminal do the job, but you can use Lingon if you'd rather not use the command line.

Here's how to do it. Just paste the following code in a text editor, and save it as plain text to your user's Library -> LaunchAgents directory (create it if necessary). Name it com.lucdesign.drivesleepfixer.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  <key>Label</key>
  <string>com.lucdesign.drivesleepfixer.plist</string>
  <key>ProgramArguments</key>
  <array>
    <string>/usr/bin/drutil</string>
    <string>list</string>
    <string>></string>
    <string>nil:</string>
  </array>
  <key>RunAtLoad</key>
  <false/>
  <key>StartInterval</key>
  <integer>540</integer>
</dict>
</plist>

This code works like this: Every nine minutes (540 seconds), a UserAgent will look for available optical drives. This will wake up the drive and restart the sleep timer, which is set to ten minutes by default.

To activate the agent, in the Terminal type this command:
launchctl load ~/Library/LaunchAgents/com.lucdesign.drivesleepfixer.plist
Alternatively, using Lingon, create a new UserAgent and paste the code in its Expert window. You can save and load your agent from here with the click of a button.

Farewell, stuck disks!

[robg adds: I haven't tested this one...]

Comments (14)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20051207044615606