7

I have seen some dmg's which not only mounts after download but also copies the installer in the download folder and open the installer in Installer Application.

I don't know how to do it?

Can anyone help?

Raiyan Kabir
  • 1,016
  • 2
  • 11
  • 23

4 Answers4

8

I haven't seen automatically opening dmg files, but it's possible to make folder open automatically after user mounts the dmg file.

Once you have created the dmg file, mount it and then issue following command:

bless --folder /Volumes/NAME --openfolder /Volumes/DIRECTORY

The NAME is your the mounted folder name and DIRECTORY is the directory that you wish to open automatically, often NAME and DIRECTORY are the same.

Community
  • 1
  • 1
7

the --folder option is not necessary if just want the dmg to open the finder folder window automatically once mounted

bless /Volumes/NAME --openfolder /Volumes/DIRECTORY

The NAME is the mounted folder name and DIRECTORY is the directory that you wish to open automatically, often NAME and DIRECTORY are the same.

krock
  • 28,904
  • 13
  • 79
  • 85
OJJG
  • 71
  • 1
  • 1
4

DropDMG works great for me:
http://c-command.com/dropdmg/

I don't know how to achieve this otherwise (free alternative / manually).

Anne
  • 26,765
  • 9
  • 65
  • 71
2

Script that will do this for you:

https://github.com/andreyvit/create-dmg

Example:

#!/bin/sh
test -f Application-Installer.dmg && rm Application-Installer.dmg
create-dmg \
--volname "Application Installer" \
--volicon "application\_icon.icns" \
--background "installer\_background.png" \
--window-pos 200 120 \
--window-size 800 400 \
--icon-size 100 \
--icon "Application.app" 200 190 \
--hide-extension "Application.app" \
--app-drop-link 600 185 \
"Application-Installer.dmg" \
"source_folder/"
Dean Liu
  • 501
  • 5
  • 12