I believe, there are a couple of options.
Install Skim PDF viewer, as has been suggested in the answers to a similar question on TeX StackExchange.
Put together something yourself using the fswatch
command, which you can install via Homebrew to provide something akin to inotify
on Linux, and make your script monitor the PDF file, so that when it is modified, some AppleScript triggers a refresh in Preview.
It would look like so:
$ fswatch -iI ./*.pdf | xargs -I{} ./RefreshPreview {}
where the RefreshPreview
script would be
#!/usr/bin/env bash
osascript -e 'tell application "Preview" to quit'
sleep 1
open -a Preview "$1"
If you don’t want Preview to come forwards and get the focus, use the following, instead:
#!/usr/bin/env bash
open -g -a Preview "$1"
Do not forget to make the script executable by running the command
$ chmod +x RefreshPreview
I just found that a somewhat simpler and more elegant script will work even better:
#!/usr/bin/env bash
osascript<<EOF
tell application "Preview" to open POSIX file "$1"
EOF