Stop the Power Button From Turning Off the Mac Display in OS X Mavericks
The Power button on newer MacBook Air and MacBook Pro models has been turned into a button on the actual keyboard, located directly above the Delete key. For the most part, this isn’t an issue, but with the introduction of OS X Mavericks, tapping on that Power button no longer prompts the Sleep / Restart / Shut Down dialog, and instead it now instantly turns the screen off, which can lock the screen if you have a wake password set.
For some MacBook Air/Pro users, that behavior change means that accidentally hitting the Power button is much more intrusive than it was before. If you’re one of the users who accidentally strikes the Power button instead of the Delete key from time to time (since they’re quite close to each other depending on your keyboard), you’ll be relieved to discover that you can change the behavior of the Power key in OS X with the help of a defaults write command. Like any other defaults command string, the change is easily reversible if you decide you don’t like how the behavior adjusts, so we’ll show you how to do both.
You’ll need OS X version 10.9 or newer to have this command string work.
Change the Mac Power Button Behavior in OS X Mavericks
Launch the Terminal, found within the Applications > Utilities folder of the Mac, and enter the exact command as shown below:
defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no
Hit the Return key to execute the defaults command string, changes will take effect immediately.
With this turned off, you’ll need to hold the power button for a second or two to trigger the pre-10.9 action of summoning the Sleep, Reboot, and Shut Down options.
Return to the Default Mac Power Button Behavior in OS X
To return to the (new) default setting of having the Power button key sleep the Mac display, use the following defaults command string instead:
defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool yes
You’ll notice the only change is the “yes” versus “no” syntax attached to the -bool flag, as is commonly the case with reversing other defaults command strings. Again, changes take effect immediately, and you’ll be back to the Power key behavior in Mavericks, meaning instant screen sleeping when the button is tapped.
I discovered this over at MacWorld after looking for a solution for repeatedly accidentally initiating display sleep on an 11″ MacBook Air, if you’re frustrated with the same thing, give this a try.