How to mount a DMG from Terminal in Mac OS X
August 30th, 2008 at 15:28If you are a Terminal lover you might try mounting .dmg files from commandline.
Basicly thats pretty easy, so just continue reading
Attaching a DMG
- Open Terminal.app ( /Applications/Utilities/Terminal.app )
- Navigate to folder containing your dmg file
- Enter: hdiutil attach myDMGname.dmg
Thats it.
Step 2 is optional so you might skip that and change step 3 to:
hdiutil attach /path/to/myDMGname.dmg
Detaching a DMG
To be able to detach a mounted dmg, we need to know the name of it as you cant be sure its the same as you used to attach the dmg itself.
- Open Terminal.app ( /Applications/Utilities/Terminal.app )
- Check the name of the mounted dmg. Its usualy mounted in /Volumes/some-random-name
- To detach enter: hdiutil detach /Volumes/some-random-name
Where some-random-name is the String you found while checking the names listed in /Volumes
I hope that was helpful
Best regards
fidel
Tags: attach, cli, commandline, detach, dmg, hdiutil, mount, terminal, utilities, volumes
