Skip to content

macOS power and host checks ​

A Mac that runs unattended, such as a CI runner, has to come back on its own after a power loss or a reboot. That needs machine-wide settings, not user preferences: pmset power settings, preferences in /Library/Preferences, and host state that only a person can change. [bootstrap.settings.macos] covers all three:

# never sleep, restart after a power loss, wake for network access
[bootstrap.settings.macos.power]
sleep = 0
disksleep = 0
displaysleep = 0
autorestart = true
womp = true
powernap = false
standby = 0

# a machine-wide preference in /Library/Preferences
[[bootstrap.settings.macos.defaults_entries]]
domain = "com.apple.loginwindow"
key = "DisableScreenLock"
scope = "system"
value = true

# state mise reports but cannot set
[bootstrap.settings.macos.expect]
filevault = false
auto_login = true
screen_lock = false

mise bootstrap applies these in its macos-defaults step, as does mise bootstrap macos defaults apply. Power settings and system preferences need root, so mise writes them with sudo, through the same privileged helper it uses for system files.

Power settings ​

Each key under [bootstrap.settings.macos.power] is a setting that pmset -a takes, and its value is a number or a boolean. true and false are written as 1 and 0.

mise reads pmset -g custom and sets only the values that differ, with one pmset -a command for every power source. A laptop has separate battery and AC settings, and status shows both when they disagree. A setting that the hardware does not support is not listed by pmset -g custom, so status reports it as unset and every apply sets it again.

sh
mise bootstrap macos defaults apply --dry-run
# sudo pmset -a sleep 0 autorestart 1

Run man pmset for the settings your Mac has. Across config files, a more local config sets a name's value, and names from every file apply. Roots that [bootstrap].config_roots selects all apply too; two roots that give one name different values are an error, and so are two roots that expect different states for one host check. Off macOS these sections are skipped, so a conflict there is not an error.

System-wide preferences ​

scope = "system" on a [[bootstrap.settings.macos.defaults_entries]] entry writes the machine-wide preference in /Library/Preferences/<domain>.plist, which every user reads, instead of the user's own. It is what sudo defaults write /Library/Preferences/<domain> writes. scope = "user" is the default.

[[bootstrap.settings.macos.defaults_entries]]
domain = "com.apple.loginwindow"
key = "PowerOffDisabled"
scope = "system"
value = true

Status reads the plist as the current user and labels the domain (system). Apply prepares each value as the current user, including a path update, and the privileged helper writes it. A system entry cannot use host = "current". The user and system scopes are separate preferences, so the same domain and key can be declared in both.

Host checks ​

Some state needs a password or a person at the screen, so bootstrap cannot set it. [bootstrap.settings.macos.expect] declares what it should be. mise bootstrap status reports each check, and mise bootstrap fails once it has applied everything else, listing every failed check and how to fix it by hand:

text
mise ERROR 2 macOS host check(s) in [bootstrap.settings.macos.expect] failed; mise cannot change these:
  filevault: expected off, found FileVault is On.; fix by hand: turn FileVault off in System Settings > Privacy & Security > FileVault, or run `sudo fdesetup disable`, then wait for decryption to finish
  screen_lock: expected off, found screenLock delay is immediate; fix by hand: run `sysadminctl -screenLock off -password -` as this user, or set "Require password after screen saver begins or display is turned off" to Never in System Settings > Lock Screen

A dry run warns instead of failing.

KeyValueWhat mise reads
filevaultBoolean: FileVault disk encryption is onfdesetup status; encryption or decryption in progress counts as on
auto_loginA user name, true for the user running bootstrap, or false for noneautoLoginUser in /Library/Preferences/com.apple.loginwindow, and /etc/kcpassword
screen_lockBoolean: a password is required after sleep or the screen saversysadminctl -screenLock status, for the user running bootstrap

Automatic login passes only when /etc/kcpassword exists too and FileVault is off, since FileVault asks for a password before macOS logs anyone in. macOS writes /etc/kcpassword when you enter the user's password under System Settings → Users & Groups → Automatically log in as.

A check that mise cannot run, for example because sysadminctl fails, is reported as failed with an unknown state, and the other checks still report. So is a failed pmset read: status shows each power setting as unknown, and mise bootstrap reports the error with the failed checks once the rest of the run is done.

These checks are built in rather than arbitrary commands, so their output is parsed the same way on every Mac and each can say how to fix it. For state that has no built-in check, use a hook or the bootstrap task.

In mise bootstrap plan, a failed check is a resource with unknown state, so mise bootstrap plan --detailed-exitcode fails until it is fixed.

On Linux and Windows ​

These sections are ignored on other platforms. Status lists them as skipped.

See also ​

MIT LicenseCopyright © 2026jdx.dev