Preview.app only auto-refreshes if you alt-tab to it

Open AppleScript Editor and enter the following:

tell application "Preview" to activate
tell application "AppleScript Editor" to activate

Replace the second application's name with the program you want to have frontmost. Save as scpt and incorporate a call to this script into your program to refresh Preview:

osascript refresh-preview.scpt

You can alternatively use Automator to create a Service that receives no input with the Run AppleScript action and the above code. Save, and assign a keyboard shortcut in System Preferences. Not exactly automatic, but easier than getting the mouse to focus Preview.


Using the program open would be another idea, although using the switch -g (don't bring to foreground) opens the file in a new preview window every time its been modified, even if it's already open. All windows get updated though, without being brought to the foreground.


Visual Studio Code allows you to open images and will also refresh them automatically without any interaction needed.


You can use XEE, it's an image preview software that includes autorefresh. (http://xee.c3.cx/)