I'm running OS X 10.8 (Mountain Lion). I was wondering if there was a terminal command to check if the macbook pro's lid is currently closed.

The reason I ask is because I have cron jobs scheduled to run every 30 minutes. However, crontab doesn't run when the computer is sleeping/hibernating. My solution was to use pmset to schedule wakes every 30 minutes. However, I need a way to put my computer back to sleep on the condition that the lid is currently closed. I don't want my computer to be awake for too long with the lid closed i.e. awake all night when I'm sleeping because that could damage the screen.


I use Caffine to keep my Mac awake. You can set it for a specific time period. Then have it stop, or shut down your computer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.