How I make a dmg installer that will automatically open after download?
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 开发者_如何学Cin Installer Application.
I don't know how to do it?
Can anyone help?
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.
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.
DropDMG works great for me:
http://c-command.com/dropdmg/
I don't know how to achieve this otherwise (free alternative / manually).
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/"
精彩评论