The Mac Observer

Mac Insomnia? Use pmset To Discover The Reason

TMO Talk (15)

pmset is a command line utility that is used to manipulate the power management settings in Mac OS X.  With this command, users can change a multitude of settings relating to their Mac’s response to certain power-related conditions, as well as troubleshoot power-related issues. This article will highlight a few of the more useful pmset commands.  For commands that have a zero at the end, simply replace the 0 with a 1 and re-execute the command to restore default behavior.

Set Your Portable Mac to Stay Asleep When the Lid is Opened

By default, Mac laptops will wake up if a sleeping machine’s lid is opened.  You can prevent this behavior and choose to wake the Mac on your own terms by entering the following terminal command:

sudo pmset lidwake 0

Conversely, add the following flag to prevent the Mac from going to sleep when the lid is closed:

sudo pmset -a lidwake 0

 

Prevent Your Mac from Sleeping When the Power Button is Pressed

ALTHave a Choice When Your Mac’s Power Button is Pressed

Pressing a Mac’s power button once will, by default, put the Mac to sleep (for Lion laptops, it brings up the power options menu).  You can prevent this behavior with the following terminal command:

sudo pmset powerbutton 0

 

Prevent Your Portable Mac from Waking When the Power Source Changes

For Mac laptops, plugging or unplugging an AC Adapter can wake the computer.  You can prevent this with the following terminal command:

sudo pmset acwake 0

 

Prevent Your Mac from Sleeping Due to Idleness

To keep your Mac awake even if you leave the computer idle, use the following command:

pmset noidle

With this command running in the Terminal, the Mac will never fall asleep no matter how long the machine is left idle.  Once you’re ready to change back to default behavior, press Ctrl-C.

 

Troubleshoot Sleep Issues

If your Mac isn’t sleeping like it should, you can run the following command to get information about all your power settings and track down the culprit that’s preventing your Mac from getting its beauty rest:

pmset -g

Use pmset to see why your Mac isn't sleeping
Track Down What’s Preventing Your Mac from Sleeping

This command will display in the Terminal window all the pmset arguments currently in use and their value.  It’s helpful to have a guide to decipher these arguments and their value indicators, so check out Apple’s Manual Page for pmset.

In this case it’s showing process ID 173 as keeping the Mac from sleeping. Using the ps command as:

ps -ax | grep 173

This shows us that coreaudiod is the culprit. In this instance, iTunes was playing a song. Stopping playback released this “imposition” and the computer was back to being allowed to sleep.

Post A Comment or Log-in. Need an account? Register here.

4 Observer Comments

Awesome tips, Jim!

I’ll have to test this out. My iMac will wake instantly when put to sleep through the menu, but sleeps just fine if it happens through the power saving feature. I think it may have something to do with the mouse.

   Actions Matt Miller said on October 5th, 2011 at 10:34 PM:

You can use ps -p 173 to get details about a specific process.

Am I wrong or the command cited…

sudo pmset -a lidwake 0

...will only prevent the computer from waking when the lid is opened on ALL power sources? I couldn’t find an option with pmset to prevent the computer from sleeping when de lid is closed.

Any clues?

Post A Comment or Log-in. Need an account? Register here.
 

Recent Headlines - Updated May 27th

Sat, 10:00 AM
MacOS KenDensed - MacOS KenDensed: Apple’s Patent Lawsuit & Antitrust Shuffle
Fri, 5:58 PM
News - Sotheby’s to Auction Steve Jobs Atari Memo (Photo Gallery)
5:42 PM
Free on iTunes - 3 Free iOS Apps for News Hounds
3:00 PM
Rumor - Nest Thermostat Reportedly Coming to Apple Retail Stores
2:40 PM
Particle Debris - The TV Industry’s Dreadful Little Secret
2:33 PM
News - Mobile Devices Account for 20% of Web Traffic in US, Canada
12:49 PM
News - Apple Now Offering “Free App of the Week” for iOS
12:21 PM
News - Tim Cook Declines $75 Million Dividend Payout
11:25 AM
News - Absinthe 2.0 Provides Untethered Jailbreak for iOS 5.1.1
11:09 AM
Quick Look Review - F18 Carrier Landing (iOS) is a Boatload of Fun
10:51 AM
TMO Appearances - Jeff Gamet talks Cool Apps & Accessories on Not Another Mac Podcast
10:12 AM
Hot Forum Topic - Forum Poll: Which is Your Favorite Photo Sharing Service?
 

The Mac Observer Reader Specials

  • Macsales Add 2nd Hard Drive or SSD to Mac mini, MacBook or MacBook Pro. 1TB of Hard Drive or SSD Capacity from $64.99! Video Guides Make it easy - OWC DataDoubler - Macsales.com
  • Mac RAM Upgrades: MacBook Pro 16GB kits $475, 8GB Kits for $119.99! iMac 16GB RAM Kits (4x 4GB) for $229.99! Mac Pro Memory 32GB Kit for $399.99, 64GB Kit for $889.99! Mac Hard Drives 2TB Seagate SATA II for $249.99! Click Here!
  • Macpokeronline.com If you're using a Mac, then you've gotta check out PokerOnAMac.com. Online casinos and poker rooms are literally giving away cash and the casino sites at Poker on a Mac do the unthinkable, they actually reward! Join today, the download is free!
  •  Looking to find online casinos for mac? We can help you find the best real money casino sites where you can play your favorite casino games including blackjack and slots.

Apple Stock Quote (AAPL)

Loading...

Hot Topics

TMO Express

Join the TMO Express Daily Newsletter to get the latest Mac headlines in your e-mail every weekday. Find out more!

Top Deals From DealBrothers.com

Recent Features

Support The Mac Observer

We noticed you may be running AdBlock on your computer. It takes real money to run this site and to deliver the news, tips, and opinions you love to read.

If you wish to block the ads that pay for the creation of our content, we ask that you instead support TMO Directly, either with a $5 monthly recurring contribution, or a one-time donation of any amount of your choice. Thanks!

Subscribe with Paypal Donate with Paypal