

Now load the configuration files with launchd: sudo launchctl load /Library/LaunchDaemons/de. Sudo cp ~/Desktop/sleepwatcher_2.2.1/config/rc.* /etc sudo cp ~/Desktop/sleepwatcher_2.2.1/config/de. /Library/LaunchDaemons/de. Create a new configuration file by copying the example configuration and rc-scripts. In order to have the Sleep Watcher run at all times, you need to make it a LaunchDaemon. You can now cancel the Sleep Watcher by pressing Ctrl C in Terminal. Did RDP close? Great! Did something go wrong? Look at the output of the sleepwatcher command to get a hint about where it failed. This appears to be a regression in macOS. Wait a couple of seconds until it really goes to sleep. 1 2 3 4 Next kapitainsky macrumors member 33 17 51 rs-mac said: Filed bug (FB9864403). This will not output anything, so leave both RDP and the Sleep Watcher running, then close the lid of your MacBook. Now test your script by first starting the RDP program, then running the following in Terminal: /usr/local/sbin/sleepwatcher -verbose -sleep ~/.sleep Now we need to make it executable: chmod +x ~/.sleep You can do this with any application as long as you change the name according to its title. SleepWatcher is a command line tool (daemon) for macOS that monitors sleep, wakeup and idleness of a Mac. This will quit the Microsoft RDP application through AppleScript commands. In this file, add the following: osascript -e 'tell application "Remote Desktop Connection" to quit' It will contain the commands that are run when the machine is put to sleep (i.e. Now, let's create a sleep script called ~/.sleep. You will be prompted for an administrator password.
DOWNLOAD SLEEPWATCHER MAC INSTALL
This will install the sleepwatcher binary and the manpages. Sudo cp ~/Desktop/sleepwatcher_2.2.1/sleepwatcher.8 /usr/local/share/man/man8

Sudo cp ~/Desktop/sleepwatcher_2.2.1/sleepwatcher /usr/local/sbin
DOWNLOAD SLEEPWATCHER MAC DOWNLOAD
Download the tool from Bernhard Baehr's homepage and follow the installation instructions: assuming you unpacked the download to your Desktop, call the following commands from a Terminal window: sudo mkdir -p /usr/local/sbin /usr/local/share/man/man8 Sleep Watcher, free and open source, but command line.

Welcome to SleepWatch, a better way to track, hack, analyze, and help improve your sleep.
