It’s been a familiar part of owning any of the best MacBooks for years: open the lid or connect your charger when it’s powered off and your laptop will automatically start up, without you having to press the power button.
To undo the commands and restore your MacBook to its previous way of working, just type sudo nvram -d BootPreference and press Return.
Next, open the Terminal app (located in the Utilities folder) and type one of the following commands, then press Return:.
Having it power on when you open the lid means you then have to turn it off again, something you wouldn’t need to bother with if you could just disable that behavior in the first place.
With the automatic startup disabled, your MacBook should only load up if you press a key or the trackpad.