?

Log in

No account? Create an account
How to unmount as unprivileged user on a Mac? - brad's life [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

How to unmount as unprivileged user on a Mac? [Mar. 12th, 2007|07:22 pm]
Brad Fitzpatrick
[Tags|, ]

Brads-Computer:~ bradfitz$ umount /Volumes/EOS_DIGITAL/
umount: unmount(/Volumes/EOS_DIGITAL): Operation not permitted
But I can click the little eject icon thingy!

How do I do that via command line?
LinkReply

Comments:
[User Picture]From: thgintaetal
2007-03-13 02:32 am (UTC)
diskutil eject
(Reply) (Thread)
[User Picture]From: crucially
2007-03-13 02:34 am (UTC)
sudo I guess

no idea how it works from the UI, I assume it sends msg to another process to do it, while umount uses syscalls?
(Reply) (Thread)
(Deleted comment)
[User Picture]From: gleamicus
2007-03-13 02:37 am (UTC)
diskutil(8)

e.g. diskutil eject /Volumes/EOS_DIGITAL
(Reply) (Thread)
[User Picture]From: jwz
2007-03-13 02:37 am (UTC)
osascript -e 'tell application "Finder" to eject disk "/Volumes/EOS_DIGITAL"'

See also mvpix.

(Reply) (Thread)
[User Picture]From: brad
2007-03-13 03:16 am (UTC)
Ah, I already wrote my own mvpix.
(Reply) (Parent) (Thread)
[User Picture]From: edm
2007-03-13 03:16 am (UTC)

Commandline ejection

My Mac is too far away to try this at present, but if it's like all most other unix automounters, you can typically go "eject /mount/point" and it'll be unmounted and the eject method called on the underlying device (which may do nothing, or may eg eject the DVD, depending on what the device driver implements). (Obviously if something is holding the mount point, such as an open file or current directory under it, then the umount will fail, and so the eject will fail.)

If not jwz's solution could presumably be wrapped in a shell script which emulated this eject behaviour for an arbitrary mount.

Ewen
(Reply) (Thread)
[User Picture]From: brad
2007-03-13 03:16 am (UTC)

Re: Commandline ejection

diskutil eject worked, once I chdir()'d my script out of the damn directory. (duh)
(Reply) (Parent) (Thread)
[User Picture]From: xlerb
2007-03-13 03:55 am (UTC)
My reflexes have failed to keep up with Apple's latest waves of deprecation and reinvention; they still say “disktool -e diskN”. I think that still even works, but the man page disapproves.
(Reply) (Thread)
[User Picture]From: erik
2007-03-13 06:13 am (UTC)
Yeah, I just thought to check tonight to see if I could use the eject button while my Mac is in a locked state. It does, of course, eject the disc, but is this ideal behavior? Theoretically if someone's sitting at the computer who doesn't have the admin password to unlock the machine I also wouldn't want them ejecting/taking my CDs. Hmm.
(Reply) (Thread)