24

I'm working using LaTeX, since I compile the document in the terminal, it would be much easier for me to open it in pdf viewer directly from the terminal.

I'm using OS X 10.8.2 in Polish, so I'm not sure of the English name of the viewer I'm using, but it's the default one, I guess it's Preview in English. But the command preview <filename.pdf> results in -bash: preview: command not found.

40

You can just use open <filename.pdf> and your OS will use the default program to view PDFs. With open -a Preview.app <filename.pdf> your PDF is opened using Preview, even if your default PDF reader is something different.

3

After discovering the "open" answer I wrote the following shell script, which I placed in /usr/bin/acroread:

#!/bin/sh
/usr/bin/open $1

Don't forget to chmod +x /usr/bin/acroread. My LaTeX workflow is homogenized by this solution.

  • 1
    With SIP most users won't be able to /usr/bin, so /usr/local/bin might be the better place for this little script. It might also be useful to use "$1" to make it work with path/file names containing spaces. – nohillside Apr 6 at 13:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .