Easy Mac Hacks: Stop Power Button from Activating Sleep

Every Monday we show you how to do something quick and cool using built-in OS X utilities such as Terminal, Apple’s command line application. These easy hacks can make life better and simpler, and don’t require any knowledge of coding — all you need is a keyboard to type ’em out!

Have you ever accidentally pressed the power button on your MacBook, only to find that you now have to go through the process of awakening your computer? While your Mac will awaken faster than any other computer on the planet, it’s still an annoying process. Fortunately, you can change the behavior of the power button so that it displays a dialog instead of powering down your computer. Continue reading to learn how to do this.


In order to change the power-button behavior, you’ll want to open the Terminal application (located in /Applications/Utilities), then type in the following command, followed by the enter key:

defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool no

When you enter this command, you’ll want to restart your Mac to ensure this new preference is loaded into the system.

Once entered and restarted, whenever you press the power button on your Mac for a second or two, you’ll be prompted to specify whether you want to sleep, restart, shut down, or cancel. No longer will your Mac choose to sleep automatically.

If you decide that you no longer wish to have your Mac do this, then you can easily reverse the command by opening the Terminal and typing in this command:

defaults write com.apple.loginwindow PowerButtonSleepsSystem -bool yes

When you restart, your Mac will be returned to its normal behavior, automatically putting the system to sleep when the power button has been pressed.

Follow this articles author, Cory Bohon on Twitter.