Stop a MacBook turning on when you open the lid or plug it in
· 5 min read
A MacBook Air or MacBook Pro with Apple silicon is designed to start up on its own when you open the lid or connect power, even if you shut it down. On macOS Sequoia or later, Apple provides a Terminal setting that changes this: sudo nvram BootPreference=%00 stops both, and sudo nvram -d BootPreference puts things back. The power button still starts the Mac as normal. Older versions of macOS have no supported way to change it.
Why a MacBook starts by itself
A laptop that turns on the moment you lift the lid is convenient most of the time. It is less convenient when:
- You open a shut-down Mac only to clean the screen or keyboard.
- You plug a shut-down Mac in to charge overnight and find in the morning that it started up and has been sitting at the login screen all night.
- The startup sound goes off in a quiet room.
This is about starting up from shut down. A Mac that is asleep wakes when you open the lid, and that is a separate behavior this setting does not change.
Check your Mac can use the setting
Two things need to be true.
- Choose Apple menu, About This Mac. The Chip line should name an Apple chip (M1 or later). If it says Processor and names an Intel chip, this setting is not documented for your Mac.
- On the same screen, check the macOS version. It needs to be macOS Sequoia (version 15) or later. If you are on an earlier version, updating is the only supported route.
Change it in Terminal
Terminal is in Applications, Utilities. Type one of the following commands and press Return. Terminal asks for your administrator password; nothing appears on screen as you type it, which is normal.
To stop the Mac starting both when you open the lid and when you connect power:
sudo nvram BootPreference=%00
To stop it starting only when you open the lid:
sudo nvram BootPreference=%01
To stop it starting only when you connect power:
sudo nvram BootPreference=%02
Then shut the Mac down, close the lid, and test it: open the lid, or plug it in, depending on what you chose. The Mac should stay off until you start it yourself.
For most people the first command is the right one. The second suits someone who likes the Mac to start when plugged in at a desk but not when opened on the go. The third suits the overnight-charging case.
Check or undo the change
To see the current value:
nvram BootPreference
If you have set it, Terminal prints the value. If you have not, it prints an error saying the variable was not found, which means the Mac is on the default behavior.
To go back to the default, starting on lid open and on power:
sudo nvram -d BootPreference
The setting lives in the Mac’s NVRAM, a small store of settings the Mac reads before macOS loads. That makes it different from the preferences you change with defaults write, which belong to your user account: this applies to the whole Mac, for every account, and it survives restarts. What defaults write does, and how to undo one safely explains the other kind. If the Mac is ever erased or comes back from a repair, run the check above again.
Stick to the commands on this page. NVRAM holds other variables the Mac depends on, and changing ones you do not recognize is a good way to spend an afternoon in Recovery mode.
What this does not change
- Starting the Mac yourself. The power button, which is also the Touch ID sensor, starts it as before. Apple notes that the change does not affect turning the Mac on with the keyboard or trackpad either.
- Waking from sleep. A sleeping Mac still wakes when you open the lid. If you want it to stay dark in a bag, shut it down rather than closing the lid on a sleeping Mac.
- Charging. A shut-down Mac still charges when plugged in; it just no longer boots at the same time. Charging habits that actually affect a MacBook battery covers the rest of that question.
- The startup sound. If the chime is the part you mind, System Settings, Sound has a Play sound on startup option you can switch off, with or without the NVRAM change.
The opposite problem: staying awake with the lid closed
People who search for this are often also fighting the reverse: a MacBook that goes to sleep when the lid closes while a long job is running. That is a different mechanism, controlled by sleep settings rather than NVRAM, and Keep a MacBook awake with the lid closed, and when not to explains the options and the heat risk.
If you would rather not keep Terminal commands for that side of it, Mainspring has a power-up that keeps the Mac from sleeping with the lid closed and another that runs caffeinate on a timer, each snapshotted before it changes so it flips back in one click. The BootPreference setting on this page is not one of its power-ups; it is a one-line Terminal job either way. Mainspring is $29 once for up to three Macs, with a free one-day trial.
Questions
Does this work on an Intel MacBook? Apple documents it for Mac laptops with Apple silicon running macOS Sequoia or later. Intel models are not covered, so do not expect the command to have an effect there.
Will a macOS update reset it?
The value is kept in NVRAM rather than in macOS itself, so an update should leave it alone. It takes seconds to confirm with nvram BootPreference after a major upgrade.
Is it safe to change NVRAM? This variable is one Apple documents for exactly this purpose, and the undo command removes it completely. The risk comes from changing other variables you have read about elsewhere, so leave those alone.