Comments on: Put OS X to sleep via command-line http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/ // TODO: insert witty tagline Wed, 14 Nov 2018 21:35:51 +0000 hourly 1 https://wordpress.org/?v=4.9.8 By: Nicolas B. http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-10254 Tue, 21 Jan 2014 00:13:38 +0000 http://localhost:8888/wordpress/?p=81#comment-10254 No. This command does not work. The ‘ ’ are wrong.

]]>
By: mynameistechno http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-10191 Tue, 14 Jan 2014 03:44:24 +0000 http://localhost:8888/wordpress/?p=81#comment-10191 Actually, if you exit your remote session immediately it will. E.g. This just worked for me via ssh:

pmset sleepnow && exit

]]>
By: lars http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-10095 Tue, 07 Jan 2014 21:42:43 +0000 http://localhost:8888/wordpress/?p=81#comment-10095 thanks justin! exactly what I was searching for ;)

]]>
By: justin http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-9292 Thu, 21 Nov 2013 01:44:54 +0000 http://localhost:8888/wordpress/?p=81#comment-9292 note that if you are remotely logged in, it won’t sleep with this or any command.

To see the reason it won’t sleep run
pmset -g assertions

then look if NetworkClientActive is “1” (or any of the other reasons).

so to do it remotely you could do
nohup /bin/sh -c ‘/bin/sleep 10 && pmset sleepnow’ &
then logout inside 10 seconds.

]]>
By: Mike Ma http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-4509 Mon, 03 Sep 2012 02:26:13 +0000 http://localhost:8888/wordpress/?p=81#comment-4509 Looks like I found the solution. For instance:
sudo pmset -a hibernatemode 1 force
pmset sleepnow

Parameter force changes settings without saving it on to the disk. So, next time hibernatemode will be the previous one.

]]>
By: Mike Ma http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-4508 Mon, 03 Sep 2012 01:56:24 +0000 http://localhost:8888/wordpress/?p=81#comment-4508 More interesting if somebody knows how to hibernate computer without changing hibernate mode?

]]>
By: Mike Ma http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-4507 Mon, 03 Sep 2012 01:53:03 +0000 http://localhost:8888/wordpress/?p=81#comment-4507 you also can use
pmset sleepnow

]]>
By: Florent Delannoy http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-3848 Sun, 24 Jun 2012 06:36:00 +0000 http://localhost:8888/wordpress/?p=81#comment-3848 Awesome, thanks!

]]>
By: Rich http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-3847 Sun, 24 Jun 2012 06:23:03 +0000 http://localhost:8888/wordpress/?p=81#comment-3847 “osascript -e ‘tell application “System Events” to sleep’ ” also works for Leopard.

]]>
By: Rich http://www.uponmyshoulder.com/blog/2010/put-os-x-to-sleep-via-command-line/comment-page-1/#comment-3846 Sun, 24 Jun 2012 06:20:28 +0000 http://localhost:8888/wordpress/?p=81#comment-3846 “pmset sleepnow”
Works great for Leopard as well.

]]>