UI and process for preventing a Mac from turning on

Last week, Apple documented how to prevent a Mac from turning on when the lid is opened or the power is connected. As a person with a set of test Macs that get opened and unplugged/plugged all the time, this is a welcome feature.

The nvram command to change this setting has a set of requirements: Apple silicon, MacBook, macOS 15, and must be run as root/sudo. To help address these requirements and provide a user interface, I wrote a swiftDialog script. If this script is launched by Jamf Self Service for instance, the nvram commands will run as root but the UI will run as the logged-in user.

The BootPreference setting does not survive Erase All Contents and Settings or a DFU Restore, but it does survive startosinstall --eraseinstall. With that in mind, if you want these preventions on your test Macs, add a one-liner to your provisioning processes, scoped just to those computers.

Leave a comment