Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > macOS > How to eject a CD via the Terminal in 10.2?

How to eject a CD via the Terminal in 10.2?
Thread Tools
iStudent 2003
Forum Regular
Join Date: Jun 2003
Status: Offline
Reply With Quote
Sep 25, 2003, 02:49 AM
 
In Linux, when you type eject in the Terminal, the CD tray opens, and when you type eject �t the CD tray closes. I tried both commands in 10.2.6, and neither of them worked. In OS 10.2, is there a command to eject the CD? My iMac has slot loading CD drive, could that be why it�s working?
     
gorgonzola
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
Sep 25, 2003, 03:58 AM
 
Not sure you can do this in 10.2...at least I can't see anything that would do it.
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
gatorparrots
Dedicated MacNNer
Join Date: Dec 2002
Location: someplace
Status: Offline
Reply With Quote
Sep 25, 2003, 12:28 PM
 
On 10.1, one can issue:
disktool -o

On 10.2, you can issue this command to enable the GUI Eject menubar item:
open "/System/Library/CoreServices/Menu Extras/Eject.menu"

Here's fink's eject package perl script:
Code:
#!/usr/bin/perl $device = $ARGV[0] || "/dev/disk1"; $device =~ s/cdrom/disk1/; exec "/usr/bin/hdiutil eject $device";
     
philzilla
Occasionally Useful
Join Date: Jun 2001
Location: Liverpool, UK
Status: Offline
Reply With Quote
Sep 25, 2003, 01:20 PM
 
Originally posted by gatorparrots:
On 10.2, you can issue this command to enable the GUI Eject menubar item:
open "/System/Library/CoreServices/Menu Extras/Eject.menu"
that doesn't exactly eject the cd though, does it...
"Have sharp knives. Be creative. Cook to music" ~ maxelson
     
[APi]TheMan
Mac Elite
Join Date: Sep 2001
Location: Chico, CA and Carlsbad, CA.
Status: Offline
Reply With Quote
Sep 25, 2003, 03:14 PM
 
Originally posted by gatorparrots:
Here's fink's eject package perl script:
Code:
#!/usr/bin/perl $device = $ARGV[0] || "/dev/disk1"; $device =~ s/cdrom/disk1/; exec "/usr/bin/hdiutil eject $device";
Two questions:

1) What does the "=~" notation mean?
2) Is that "s/cdrom/disk1/" a sed-typed replace function?
"In Nomine Patris, Et Fili, Et Spiritus Sancti"

     
Moonray
Mac Elite
Join Date: May 2001
Status: Offline
Reply With Quote
Sep 25, 2003, 03:48 PM
 
To eject a CD in Mac OS X you simply type:

disktool -e disk1

Of course if your CD drive is /dev/disk3 you use disk3 there. Make it an alias and call it eject or whatever you like. Starting a perl script for that is like shooting ants with cannons.

Unlike in other operating systems there is no /dev/cdrom - does anyone know how to find out which drive(s) are CD/DVD-ROMs or ejectable?

-
     
P
Moderator
Join Date: Apr 2000
Location: Gothenburg, Sweden
Status: Offline
Reply With Quote
Sep 25, 2003, 04:54 PM
 
Originally posted by Moonray:
To eject a CD in Mac OS X you simply type:

disktool -e disk1

Of course if your CD drive is /dev/disk3 you use disk3 there. Make it an alias and call it eject or whatever you like. Starting a perl script for that is like shooting ants with cannons.

Unlike in other operating systems there is no /dev/cdrom - does anyone know how to find out which drive(s) are CD/DVD-ROMs or ejectable?

-
If you have disc inside, type "df". In my case, it shows a number of lines related to all currently mounted drives. Among mine, there is currently one line like this:

/dev/disk1s1s2 678832 678832 0 100% /Volumes/MOO3 Play Disc

"MOO3 Play Disc" is a CD that I have mounted, so "disk1" is a CD (or rather, DVD).
     
iStudent 2003  (op)
Forum Regular
Join Date: Jun 2003
Status: Offline
Reply With Quote
Sep 25, 2003, 04:59 PM
 
Thanks everyone!

disktool -e disk1

Worked and when i typed disk2 it ejected my firewire CD-R tray, but it only works when there is a CD in the tray.

Also, is there a command to close the tray on my firewire CD-R?
     
gorgonzola
Admin Emeritus
Join Date: Nov 2000
Location: New Yawk
Status: Offline
Reply With Quote
Sep 25, 2003, 07:07 PM
 
Oh, good one. Forgot that disktool doesn't have a manpage...
"Do not be too positive about things. You may be in error." (C. F. Lawlor, The Mixicologist)
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 11:49 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,