Skip to content

Preferences

Nick McSpadden edited this page Sep 16, 2019 · 11 revisions

Preferences supported by autopkg

The following preferences can be set to customize behavior of autopkg. All use the domain com.github.autopkg, so to set, for example, the cache directory to an alternate location:

defaults write com.github.autopkg CACHE_DIR /path/to/cache/dir

Supported preferences

Preference key Type Default Description
CACHE_DIR String ~/Library/AutoPkg/Cache Location for cached data such as downloads and unarchiving/packaging operations. Must be a volume that supports setting ownerships and permissions.
MUNKI_REPO String (none) Location where a Munki repository is mounted. `autopkg` does not handle mounting/unmounting this location for you.
RECIPE_SEARCH_DIRS String or array of strings `[ '.', '~/Library/AutoPkg/Recipes', '/Library/AutoPkg/Recipes' ]` Location(s) that are searched for recipes. If an array, they will be searched in order and the first recipe found will be used.
RECIPE_OVERRIDE_DIRS String or array of strings `[ '~/Library/AutoPkg/RecipeOverrides' ]` Same as `RECIPE_SEARCH_DIRS` but for override files.
RECIPE_REPO_DIR String ~/Library/AutoPkg/RecipeRepos Parent directory in which to store recipe repos added with `autopkg repo-add`.
GIT_PATH String (None) Absolute path to a git binary to use for the various 'repo' subcommands using Git. This overrides the default behavior of using the first 'git' executable found in the PATH environment variable, falling back to `/usr/bin/git`.

This is not a complete list. Processor input variables can be set as preferences this way. However keep in mind that if recipes or recipe overrides also set the same variable that those values will be what autopkg respects. You might want to read up on recipe overrides and input variables to gain context about the interaction of variables, recipes and overrides.

Using external preferences files

As of AutoPkg 1.2, it's possible to use an external Plist or JSON file for passing in preferences to AutoPkg, using the --prefs argument to each verb.

The external file must be a simple Plist or JSON dictionary containing key/value pairs. They are treated identically as the macOS preference keys. AutoPkg will treat malformed preferences the same way it already does, which is to say that you may experience very unexpected results. AutoPkg expects this file to be writable, just like the macOS preferences. Operations that change the preferences, such as autopkg repo-add or autopkg repo-delete will attempt to write changes to this file, and failing to do so may result in unexpected behavior.

You may also pass in arbitrary keys just as if you had used defaults write, but they'll be ignored unless you have something that consumes them.

This does not replace or extend the behavior of overrides or passing in input variables using -k. It is only intended to allow AutoPkg to consume its preferences from a source other than the macOS preferences system.

Converting existing preferences into an external file

The easiest way to test this is to simply copy your existing AutoPkg preferences plist somewhere else:

$ cp ~/Library/AutoPkg/Preferences/com.github.autopkg.plist ~/autopkg_prefs.plist
$ defaults delete com.github.autopkg
$ autopkg repo-list --prefs ~/autopkg_prefs.plist

You may also use JSON to pass in the same data, if that format is easier to set up in your automation environment.

Clone this wiki locally
You can’t perform that action at this time.