Posts RSS Comments RSS 48 Posts and 155 Comments till now

Creating Internet-enabled Disk images

What is an Internet-enabled disk image?

Basically, an internet-enabled disk image is a standard .dmg file with one small change. When it is downloaded using a browser it will automatically decompress the image, put the application or folder on the desktop, unmount and remove the disk image file. This way users don’t have to deal with downloading an image, double-clicking on it, dragging out the files, etc. It’s all done in one fell swoop.

How do I make my images internet-enabled?

First you have to create a disk image. There are lots of tutorials out there on how to do this (it’s quite easy). There are also a few applications that will do it for you, such as DropDMG. Apple even has an Automator action that will do this for you.

Once you’ve created your disk image fire up Terminal and use the hdiutil utility. The option we want is internet-enable -yes.

So, if I have a disk image on our desktop named myapp.dmg I would use the following syntax:

hdiutil internet-enable -yes /Path/to/image/myapp.dmg

Since I find myself creating these files a lot for installer packages I’ve found an easier way. Paste this text into Script Editor and save it as an application. It will create a droplet. Then just drag and drop your disk image file on the droplet and it will be instantly internet-enabled!

[codesyntax lang=”applescript” lines=”no”]
on open theFile
tell application “Finder”
set theNamePath to (theFile as text)
set theName to the name of the file theNamePath
end tell
set thePath to the quoted form of the POSIX path of theFile
try
do shell script “/usr/bin/hdiutil internet-enable -yes ” & thePath
display dialog “The disk image ” & (ASCII character 34) & theName & (ASCII character 34)¬
& ” has been successfully internet-enabled!”
on error errmsg
display dialog “Oops! This error occured: ” & return & return & ¬
errmsg buttons {“OK”} default button 1
end try
end open
[/codesyntax]

Comments are closed.