pkg
Install macOS .pkg installer packages with the system installer command.
Use this for tools distributed as signed Apple installer packages instead of tarballs, binaries, or DMGs.
Basic Usage
Section titled “Basic Usage”import { defineTool } from "@alexgorbatchev/dotfiles";
export default defineTool((install) => install("pkg", { source: { type: "url", url: "https://example.com/releases/my-tool.pkg", }, }).bin("my-tool"),);Parameters
Section titled “Parameters”source(required){ type: 'url', url }{ type: 'github-release', repo, version?, assetPattern?, assetSelector?, ghCli?, prerelease? }assetSelectorgoes insidesource, next to the repository it selects from, and behaves as it does forgithub-release: see github-release › With an Asset Selector.- A
github-releasesource’sversiontakes precedence over.version(), anddotfiles updaterefuses a tool it pins (tool update).
target(optional): target volume forinstaller -target. Defaults to'/'.binaryPath(optional): absolute path to the primary installed binary. If omitted, each declared.bin()name is resolved fromPATHafter install.versionArgs(optional): args used for version detection.versionRegex(optional): regex used for version detection.token(optional): GitHub API token for agithub-releasesource.
Examples
Section titled “Examples”install("pkg", { source: { type: "url", url: "https://example.com/releases/my-tool.pkg", }, binaryPath: "/usr/local/bin/my-tool",}).bin("my-tool");install("pkg", { source: { type: "github-release", repo: "owner/tool", assetPattern: "*macos*.pkg", },}) .bin("tool") .sudo();- macOS only. Non-macOS platforms skip this install method.
.pkg-installed tools are externally managed: the macOS installer owns the files, and.bin()names the executables the package provides so dotfiles can shim them (see.bin()runtime behavior).- Packages that declare root authorization should opt into
.sudo()so explicitdotfiles install <tool>runs execute the macOS installer viasudo. - GUI-only packages can omit
.bin(). - If the binary is not on PATH after installation, set
binaryPathexplicitly.