Shell Command for Mac Sleep?

Discussion in 'macOS' started by jaime.flores, Oct 29, 2007.

  1. jaime.flores macrumors newbie

    Oct 29, 2007
    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.


    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.
  2. rion macrumors newbie

    Dec 14, 2007
    /usr/bin/osascript -e 'tell application "System Events" to sleep'

    will do the trick. osascript runs applescript code from the command line.
  3. jaime.flores thread starter macrumors newbie

    Oct 29, 2007
    Haha, I'd given up on this post. Thank you for replying :D

  4. iCeFuSiOn macrumors 6502a

    Jul 18, 2007

Share This Page