James Tauber

journeyman of some

blog > 2006 > 03 > 02 >

Mounting Disk Images From OS X Terminal

Sometimes, to install software on my remote Mac Mini, I need to be able to mount disk images from a terminal session.

I just discovered how to do this. The command is hdiutil.

To mount a disk image:

hdiutil attach SomeDiskImage.dmg

Although I haven't tried it, I believe the disk image can be referenced by URI.

To unmount:

hdiutil detach /Volumes/SomeDiskImage/

I've added this to my Headless Tiger page.

Categories:
prev « os_x » next

Comments (6)

Tim Bray on March 3, 2006:

Well you know, in the shell you can just say "open Foo.dmg" and the right thing wil happen. Wonderful thing, that open command. Then, if you're an old unix hack, you can say "sudo umount /Volumes/Foo"

James Tauber on March 3, 2006:

Thanks Tim, I hadn't thought to try open for mounting disk images. The hdiutil command is still handy for other disk-image-related operations, it seems.

Chris on July 31, 2006:

Thank you very much, this is exactly the command I needed for my install package.

sxtxixtxcxh on Oct. 13, 2006:

yay for google. this command exactly what i needed. open will literally open the disk image, and display the window. you're not gonna want a window opened if you're headless.

sxtxixtxcxh on Oct. 13, 2006:

i know i JUST commented, but you can also install mpkg files from the command line.

check out http://www.afp548.com/articles/system/headlessg5.html

cenk on Jan. 18, 2007:

Thanks a lot for this!

cya,
cenk
Created: March 3, 2006
Last Modified: March 3, 2006
Author: jtauber