| How to unmount as unprivileged user on a Mac? |
[Mar. 12th, 2007|07:22 pm] |
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? |
|
|
| Comments: |
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?
diskutil(8)
e.g. diskutil eject /Volumes/EOS_DIGITAL
![[User Picture]](http://p-userpic.livejournal.com/5887295/515656) | From: jwz 2007-03-13 02:37 am (UTC)
| (Link)
|
osascript -e 'tell application "Finder" to eject disk "/Volumes/EOS_DIGITAL"'See also mvpix.
![[User Picture]](http://p-userpic.livejournal.com/54541970/2) | From: brad 2007-03-13 03:16 am (UTC)
| (Link)
|
Ah, I already wrote my own mvpix.
![[User Picture]](http://p-userpic.livejournal.com/4980108/1052633) | From: edm 2007-03-13 03:16 am (UTC)
Commandline ejection | (Link)
|
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
![[User Picture]](http://p-userpic.livejournal.com/54541970/2) | From: brad 2007-03-13 03:16 am (UTC)
Re: Commandline ejection | (Link)
|
diskutil eject worked, once I chdir()'d my script out of the damn directory. (duh)
![[User Picture]](http://p-userpic.livejournal.com/3078394/780805) | From: jdev 2007-03-13 03:55 am (UTC)
| (Link)
|
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.
![[User Picture]](http://p-userpic.livejournal.com/39022159/14) | From: erik 2007-03-13 06:13 am (UTC)
| (Link)
|
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. | |