refresh Preview from command line

Solution 1:

No simple solution that I can think of.

  • You can switch to using Skim, or another PDF previewer that supports the behavior you seek.
  • You can "open file.pdf" to refresh and bring Preview to the foreground, and then another command to bring your editor or terminal in front of it (open file.pdf; open -a Terminal.app).

Solution 2:

If you want to use Applescript to bring Preview to the front, then all you need is this line:

tell application "Preview" to activate

You could also use the osascript command in the command line to run that script as well. There are specific things to look out for (escaping quotes and handling multiple lines). Examples on its exact use abound and it has its own man page.