On my Macbook Pro, whenever you press the power button it goes into sleep mode. How do I change this to do nothing?
2 Answers
You can control whether pressing the power button should put your mac to sleep or present a dialog with options (sleep/restart/shut-down) using the pmset
command. The following:
sudo pmset powerbutton 1
will put it to sleep right away (presumably your current setting) and changing 1
to 0
will present you with the dialog.
Pay attention to the fact that it's not a per-user setting, and changes the behaviour for all users. Something to keep in mind if you share the device with others. From the man page (explore it for other options):
All changes made through pmset are saved in a persistent preferences file (per-system, not per-user) at /Library/Preferences/SystemConfiguration/com.apple.PowerManagement.plist
-
2Seems this does not work for Mavericks. It gives "Usage: pmset <options>" output. Any thoughts?– lulalalaCommented Oct 28, 2013 at 6:33
-
2I can confirm,
pmset
in Mavericks doesn't accept powerbutton arguments.– nine9thsCommented Nov 12, 2013 at 21:07 -
4So irritating that someone clear used time to remove functionality that everybody is crying for now! Commented Dec 12, 2013 at 14:42
defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no
Is working for me on 10.9.5, and gives behavior very close to how the power button used to work for me on 10.6. Though there is a bit more of a delay, it's definitely not infuriating anymore.
http://www.defaults-write.com/10-9-stop-the-power-button-from-putting-your-mac-in-stand-by-mode/
-
Not working for me in Sierra / macOS 10.12; nothing happens when I pressing the power button. OTOH, I can hit Ctrl-PowerButton to get a dialog, whether this is set to yes, no or unset. Commented Oct 3, 2016 at 15:42