Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jaime.flores

macrumors newbie
Original poster
Hey, I wanted to know if there is simple shell/terminal (non-applescript) command for putting a mac to sleep. I've been looking around but I can't seem to find one, or any documentation that might point me to one.

My aim is to have Carbon Copy Cloner put my computer to sleep after it finishes a clone. I'm trying to do it through a shell script that I can point CCC to through the "Advanced Settings" in the app.

I appreciate any help.

--Jaime

P.S. To Admins: I wasn't sure which forum was more appropriate for this thread, this forum or the Mac Programming forum. If the latter is more appropriate, please move my thread. Thanks.
 
/usr/bin/osascript -e 'tell application "System Events" to sleep'

will do the trick. osascript runs applescript code from the command line.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.