Command Line Interface

Per Olofsson edited this page Sep 15, 2017 · 13 revisions

As of version 1.3 AutoDMG has a command-line interface. It's targeted at users who wish to automate builds and exposes some advanced functionality that isn't (yet?) available in the GUI.

Starting AutoDMG in CLI mode

You can start AutoDMG by executing the binary inside the app bundle and giving it an argument (without arguments the GUI launches). For example -h will show you the usage:

termos:~ user$ /Applications/AutoDMG.app/Contents/MacOS/AutoDMG -h
usage: AutoDMG [-h] [-v] [-L LEVEL] [-l LOGFILE] [-r]
               {build,download,list,update} ...

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         Verbose output
  -L LEVEL, --log-level LEVEL
                        Log level (0-7), default 6
  -l LOGFILE, --logfile LOGFILE
                        Log to file
  -r, --root            Allow running as root

subcommands:
  {build,download,list,update}
    build               Build image
    download            Download updates
    list                List updates
    update              Update profiles

A note on sudo

AutoDMG requires root privileges to execute the OS X installer and will prompt you for your password in order to elevate to root. You can avoid the prompt if you execute AutoDMG with sudo, but be warned that this will execute the whole application as root, not just the image generation. This means that it will store updates in /var/root/Library/Application Support/AutoDMG, preferences in /var/root/Library/Preferences, and so on. Unless you're putting AutoDMG in a script or automatic build system you should probably avoid running it with sudo. This also has the benefit of sharing preferences, updates, etc with the GUI.

Global Options

-v, --verbose

Makes AutoDMG print more information to stdout.

-L LEVEL, --log-level LEVEL

Set the log level, where 0 is silent and 7 is debug logging. The default 6.

-l LOGFILE, --logfile LOGFILE

Save the log to a file. You can also use --logfile - to redirect the log to stdout.

-r, --root

Allow running as root. Normally AutoDMG stops you from running as root, see A note on sudo above.

Subcommands

You can run each subcommand with -h to see what arguments are supported.

build

The build command is used to build images. It expects either an OS X installer as the first argument, or a template file.

When a template is used command-line arguments can be used to override options specified in the template.

-o OUTPUT, --output OUTPUT

Set the DMG output path.

-i INSTALLER, --installer INSTALLER

Override installer in template.

-n NAME, --name NAME

Set the volume name of the installed system.

-s SIZE, --size SIZE

Specify system volume size, in GB.

-u, --updates

Apply software updates.

-U, --download-updates

Download uncached updates before starting the build.

-f, --force

Overwrite output image even if it exists.

-F {apfs,hfs}, --filesystem {apfs,hfs}

The filesystem to use for 10.13+ images.

list

List the available software updates from Apple given a version and build such as 10.9.2 13C64.

download

Download missing software updates to the cache, expects a version and build such as 10.9.2 13C64.

update

Download the latest list of software updates.

-u URL, --url URL

Download update profiles from a custom URL.

Examples

Fetch the latest update profile (as the logged-in user, see "A note on sudo", above):

/Applications/AutoDMG.app/Contents/MacOS/AutoDMG update

Download any uncached updates for a specific build of 10.12.4:

/Applications/AutoDMG.app/Contents/MacOS/AutoDMG download 10.12.4 16E195

Dump the full debug log to stdout, download any uncached updates, override the installer source, and build an image using the MySite template:

    /Applications/AutoDMG.app/Contents/MacOS/AutoDMG --log-level 7 --logfile - \
        build --download-updates --installer /Applications/Install\ OS\ X\ Mavericks.app MySite.adtmpl
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.