Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save halbtuerke/21292 to your computer and use it in GitHub Desktop.
Save halbtuerke/21292 to your computer and use it in GitHub Desktop.
Go through the tutorial at http://postpostmodern.com/instructional/screenwatcher/ and then come back here.
Here’s the way I got it to work on OS X Leopard.
Change the shell script to:
#!/bin/bash
PID=`ps -ax | grep loginwindow.app | grep -v grep | awk '{print $1}'`
# Change to a Screenwatcher directory in your home directory
cd /Users/patrick/Pictures/Screenwatcher
# Make a directory based on the date
mkdir -p `date "+%Y-%m-%d"`
# Capture
launchctl bsexec $PID screencapture -C `date "+%Y-%m-%d"`/`date "+%H.%M"`.png
Type this in your Terminal if you already have gone through the above tutorial:
launchctl unload ~/Library/LaunchAgents/
sudo cp launchctl unload ~/Library/LaunchAgents/ /Library/LaunchAgents/
sudo launchctl load /Library/LaunchAgents/
That worked for me. I think the problem lies in the new permission system on Leopard.
@rgaufman
Copy link

rgaufman commented Apr 4, 2020

Doesn't work for me :( - any ideas?

Mac-Pro.local ➜  Tether  PID=`ps -ax | grep loginwindow.app | grep -v grep | awk '{print $1}'`
Mac-Pro.local ➜  Tether  echo $PID
162
Mac-Pro.local ➜  Tether  launchctl bsexec $PID screencapture test.png
could not create image from display 0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment