So I want to use LaTeX in sublime text 2, and I came across the plugin LaTeXTools. It works great, but it requires me to install Skim PDF Viewer. Is it possible to set it up so that when I compile the latex file it opens it in the PDF preview already installed on my mac?

  • 1
    "On OSX, you need to be running the MacTeX distribution (which is pretty much the only one available on the Mac anyway) and the Skim PDF previewer.". They are calling the previewer by the command line. I guess you have to contact those guys (github.com/SublimeText/LaTeXTools/issues) to ask for other viewers resp. their support.
    – LaRiFaRi
    Commented Jul 22, 2013 at 18:29
  • 7
    I would strongly recommend to just use Skim. To my knowledge it is the only MacOS PDF viewer that supports auto refresh and pdfsync integration, so that you can easily navigate between your TeX source and the PDF preview.
    – Daniel
    Commented Jul 22, 2013 at 18:55
  • 1
    You can do this if you really want to (it will take some work, and knowledge of python) by hacking the package source. To get to it, got to Preferences -> Browse Packages..., select LatexTools, and then jumpToPdf.py; this calls a shell script that calls applescript to get Skim to do its thing. There are various options for restructuring this. However, the reason this isn't an option is that preview doesn't have good support for reloading changed files (IIRC it varies by version too), and there is no API to make it as smooth as the interface with Skim. Basically, it's not worth it...
    – kgr
    Commented Jul 22, 2013 at 20:06
  • 1
    I would also like reconfigure Sublime to use Preview.app. In OSX Mavericks the Preview app does automatically refresh a changed PDF and I have no interest in forward search. My main interest is in minimising the amount of unnecessary third party software on my laptop.
    – Ubiquitous
    Commented Nov 13, 2013 at 12:30
  • Preview has some advantages over Skim, such as a proper fullscreen mode that allows you to switch between your PDF and source code with multi-touch.
    – Ubiquitous
    Commented Nov 14, 2013 at 20:45

7 Answers 7


UPDATE: This does not work as advertised.

I undeleted this post after @Bordaigorl posted the same solution. There are still some unresolved issues. Changing viewPDF.py appears to work only if Skim is not installed.

The PDF-viewer in the LaTeXTools-package is configured in a file called viewPDF.py — as @kgr already pointed out. For OSX you can change the viewer form skim to preview by changing line 44 from:

viewercmd = ["open", "-a", "Skim"]


viewercmd = ["open", "-a", "Preview"]

But I would recommend against it. Skim is an excellent PDF viewer that takes under 10 MiB on your harddisk.

  • I already changed that line to viewercmd = ["open", "-a", "Preview"] in viewPDF.py, but Sublime still opens skim rather than preview when I build my LaTeX project. I appreciate that Skim has its advantages, but there are nice things about the preview app, such a proper full screen support that allows me to do a multitouch swipe to quickly sqitch between my source and the preview.
    – Ubiquitous
    Commented Nov 14, 2013 at 10:15
  • You have to remove Skim.app from your system to make it work.
    – DG'
    Commented Nov 20, 2013 at 20:25

The LaTeXTools plugin invokes the viewer from viewPDF.py.

Line 39 to 44 is the code which is selecting the commands to invoke when running on OSX:

    if s == "Darwin":
        # for inverse search, set up a "Custom" sync profile, using
        # "subl" as command and "%file:%line" as argument
        # you also have to put a symlink to subl somewhere on your path
        # Also check the box "check for file changes"
        viewercmd = ["open", "-a", "Skim"]

As you can see the Skim command is hard-coded in the script so there is no setting you can change to modify it from outside the script itself.

The simplest patch is replacing line 44 with

viewercmd = ["open", "-a", "preview"]

but be aware that if you installed Package Control and LaTeXTool gets updated you loose your patch.

So the best solution would be to open an issue on github suggesting they could read the command to be launched from a setting instead of hard-coding it.

  • Have you really tried that? Did it really work? I thought that that was a solution, but it did never actually work . . .
    – DG'
    Commented Nov 20, 2013 at 19:00
  • @DG' I made it a community wiki so we can maybe make it work together. I do not have access to a machine running OSX at the moment so I can't debug it properly. In principle that is the solution, I am not actually sure how you should invoke preview.app
    – Bordaigorl
    Commented Nov 20, 2013 at 19:33
  • Does it work with "Preview" capitalised?
    – Bordaigorl
    Commented Nov 20, 2013 at 19:35
  • 3
    Ok, maybe I know why. Are you sure you are actually invoking the view_pdf command? If you open the sublime console and type window.run_command("view_pdf") does it work? If so it means that you were actually calling the jump_to_pdf command which also has the invocation to Skim hardcoded.
    – Bordaigorl
    Commented Nov 20, 2013 at 21:50
  • 1
    I replaced line 341 in makePDF.py with window.run_command("view_pdf") and it worked. I don't know if I broke something else, but so far it works.
    – arjenz
    Commented Nov 29, 2013 at 20:27

Skim doesn't work currently in OSX Yosemite, so it looks like we're stuck with Preview for the time being.

I'm not sure what line @arjenz is referring to in his comment, since the code may have changed, but I couldn't get his solution to work. Here's what I did:

Find the jumpToPDF.py file, and change the lines (62-70 in commit 517c5a3):

if plat == 'darwin':
        options = ["-r","-g"] if keep_focus else ["-r"]     
        if forward_sync:
            subprocess.Popen(["/Applications/Skim.app/Contents/SharedSupport/displayline"] + 
                            options + [str(line), pdffile, srcfile])
            skim = os.path.join(sublime.packages_path(),
                            'LaTeXTools', 'skim', 'displayfile')
            subprocess.Popen(['sh', skim] + options + [pdffile])

To this:

    if plat == 'darwin':
        subprocess.Popen(["open", "-a", "Preview"] + [pdffile])

I am also not sure what this breaks, if anything, but the package is working fine so far.

  • This doesn't jump to a specific line though, does it? Commented Sep 7, 2015 at 10:52
  • No, it doesn't.
    – kennysong
    Commented Sep 7, 2015 at 10:57

A more updated answer; the best shot for switching to Preview.app is, in viewPDF.py, to set:

    if s == "Darwin":
        viewercmd = ["open", "-a", "Preview"]

With this, after compiling, you should be able to execute window.run_command("view_pdf") in the console and it should open the generated pdf with Preview. Then, in makePDF.py, change:

        if can_switch_to_pdf:
            self.window.active_view().run_command("jump_to_pdf", {"from_keybinding": False})


        if can_switch_to_pdf:

In do_finish method inside make_pdfCommand class, or just change:




In the previous line.

Hope it helps, tested it last night and it works!

PS: run_command should be executed on self.window, otherwise it woud not recognize window object.

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format.
    – Symbol 1
    Commented Aug 26, 2015 at 9:28

The latest (2016) answer, following the addition of user-selectable viewers in bug fix #454, is to open your user preferences (Preferences → Package Settings → Latextools → Settings - User), and add the line with your previewer of choice.

In my case I added this to the main body of the preferences (i.e., not in the osx section, that didn't seem to work):

"viewer": "preview",

This is documented in the Latextools 'manual' on Viewers. There is also a command viewer which will run your favorite viewer from the command line.


After installing Skim, I used package manager to uninstall LatexTools, then reinstall LatexTools and restarted Sublime. Then go into Skim-->Preferences-->Sync (tab), and click "Check for changes" and choose Sublime Text from the dropdown box. Finally, in Sublime Text when wanting to build you .tex file, click Tools--> Build System and there's one that LatexTools puts in called "LaTex". Use that to build and voila! upon building it opens the pdf in Skim. Also, upon rebuild it rebuilds and Skim doesn't lose your cursor placement upon the refresh.


It's quite simple actually. This solution is ST3 and I don't know if the same applies to ST2.

  1. Open Sublime Text 3
  2. Go to Preferences-->Package settings-->LateXTools
  3. Select Settings-user from the menu. If this hasn't been created, it will prompt you to do so.
  4. Use Ctrl + F to get a kind of search bar at the bottom. Type "viewer"(with the quotes)
  5. You will see commented out viewer settings. Beneath you will see something like "viewer": ",

  6. Add preview there like this: "viewer": "preview",

  7. After typing out your TEX, add \preview to it and build

You must log in to answer this question.

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