Making your first PDF with LaTeX and Sublime Text 2 for Mac

Why use LaTeX? LaTeX is the standard typesetting for economists. Equations are easier to type, making citations is a breeze, and your finished paper just looks more beautiful. Goals: By the end of the tutorial, you should:

  • Have LaTeX installed on your Mac
  • Install and be able to use a text editor, in this case Sublime Text 2
  • Create your very first LaTeX article!

If you are one of the many moving from Sublime Text to Atom, check out our new tutorial for Atom: Creating Your First PDF with LaTeX and Atom What you need:

  • Mac
  • At least 3gb of free hard drive space
  • A high speed internet connection


  • Visit and download the latest MacTex.pkg. The file is 2gb and will take a while to download. Go grab a coffee.
  • When it is finished downloading, double click the downloaded file and install. This should take up between 2-3gbs of space on your computer.
  • After you are finished, you should see that lots of program were installed. Just ignore them for now.

Step 2: INSTALLING SUBLIME TEXT 2 We need a text editor to write our LaTeX documents in. We could technically use any text editor/coding software, but we like this one a lot. There are lots of great features (e.g., snippets), so even if you have a preferred text editor, give this one a shot. Sublime Text 2 is free to evaluate with no enforced time limit for the evaluation, although they do occasionally ask you if you would like to purchase. You don’t have to purchase, but if you find it useful, you should.

  • Go to and download the latest version.
  • When it’s done downloading, install it like any other program. (This means drag it into the applications folder).

Step 3: INSTALLING PACKAGE CONTROL We need package control so that Sublime can do fancy things with our LaTeX documents.

  • Go to the package control website,
  • Highlight the code in the gray square and copy it.
  • Open Sublime Text 2
  • Access the Console by pressing “Control+`” (That’s the key right under the escape key). A white window should pop up.
  • Paste the text you copied earlier into the bottom of the console.
  • Press “Enter” and let Sublime Text 2 work its magic. Then close and restart Sublime Text 2.


  • Now that Sublime Text 2 is restarted, press “Command+Shift+P” to open the command pallet. Alternatively you can find it in the Tools menu
  • Start typing “Install Package” and you’ll find it auto-completes if for you. Select and hit “Enter“.
  • Screen Shot 2013-01-14 at 4.48.38 PMAfter it is finished installing repositories, you should see another text box. Start typing “LaTeX Tools” to find it (don’t worry about capitalization), and install the package.
  • Quit and restart Sublime Text 2

Step 5: INSTALLING INVERSE SEARCH We want inverse search so that when Sublime Text 2 loads the PDF viewer, clicking on text in the PDF viewer brings us back to our LaTeX code. This is very helpful in proofreading changes you have been making to your document.

  • Download and install SKIM PDF viewer.
  • Open Skim, go to Preferences > Sync
  • Uncheck “Check for file changes” option
  • Under Preset type “Custom
  • Set the Command to:
    /Applications/Sublime Text
  • Finally set Arguments to:
  • Screen Shot 2013-01-14 at 4.54.32 PMClose and done!


Now that you have installed Sublime Text 2 (ST2) and LaTeXTools, open a new file in ST2 (using the menu or Command+N). Copy and paste the following LaTeX source into your new file:

\documentclass{article} \title{Title} \author{Your Name} \begin{document} \maketitle{} \section{Introduction} This is where you will write your content. \end{document}

Save the file (using the menu File>Save or Command+S) as first.tex. After saving, build the PDF (using the menu Tools>Build or Command+B). You should see the PDF previewer display your first PDF. Congratulations! Step 5: ALL DONE! Congratulations! You are all done installing Sublime Text 2 to work with LaTeX and on your way to creating your first document. Next, you’ll want to learn how to use and create snippets to make your life even easier.


  1. Thanks for the tutorial Chaning!

    Just in case anybody else has problems running Skim the first time:

    Once you’ve installed Skim, you may need to manually override the Gatekeeper settings by choosing open from the shortcuts menu. After doing this once, the application can be opened in the usual way.

    To open Skim using the shortcuts menu, go to your Applications folder in Finder, press the Control key and click Skim. Choose Open from the shortcut menu, then click Open in the dialog box. This makes an exception to your settings so you can just double-click Skim next time.

  2. Moritz Demmer says:

    Hi, when I use this setup everything works just fine except the forward search and the actual syncing between Skim and Sublime. So, when I compile a .tex-file, Skim does not pop up and shows me the pdf and when I use the forward-search shortcut, it does not show me the position in the pdf. Inverse search works, though… In addition when Skim is already open and showing my pdf, it wont reload and show me the changes I made since the last compiling… Can anyone help me with this?

    P.S.: Sorry for my bad english…

    • I found this at

      On the Mac, if you have Skim running without any windows open, and you try to compile a file or view the current PDF file (with ctrl+opt+v), nothing will happen. Close Skim and try again.

      I hope this helps! If not, you should be seeing something like the following after you compile on the bottom of ST2:

      [Compiling /Users/jon/test.tex]
      Texification succeeded: no errors!

      If you see something different, paste it in a reply.


      • Moritz Demmer says:

        Thanks for the fast reply. I don’t think that this is my problem, because Skim is either not open (and does not start / pop up with the freshly compiled pdf) or it is open with the last compiled pdf and does not refresh when I compile again… Maybe my console output helps?

        [u'latexmk', u'-cd', u'-e', u"$pdflatex = 'pdflatex -interaction=nonstopmode -synctex=1 %S %O'", u'-f', u'-pdf', u'/Users/moritzdemmer/Dropbox/FP/V64-Moderne_Interferometrie/Protokoll/V64.tex']
        Welcome to thread Thread-77
        Finished normally
        • What version of latexmk do you have installed (I have version 4.31)?
          (enter the the command “latexmk” in terminal to find out). If it appears that latexmk is installed correctly, I would recommend going to the LaTeXTools README and following the setup instructions there.

          • Moritz Demmer says:

            Sorry for the late reply. Although my TeX Live package manager said I have latexmk installed, latexmk would not work as a command in the terminal. But even when I installed it, forward search was still not working. What I am doing right now is installing the newest TeX Live and then setting up LaTeXTools as instructed on their github…

      • Hi, Jonathan,

        What if I see something like,

        [Compiling /Users/xenia/Documents/LaTex/first.tex]

        TraditionalBuilder: Invoking latexmk… done.

        No errors.

        Is there anything wrong?

  3. ld: warning: ignoring file /Users/Rocela/Desktop/Dropbox/Programming/Latex/pruebita/untitled.tex, file was built for unsupported file format ( 0x5c 0x64 0x6f 0x63 0x75 0x6d 0x65 0x6e 0x74 0x63 0x6c 0x61 0x73 0x73 0x7b 0x61 ) which is not the architecture being linked (x86_64): /Users/Rocela/Desktop/Dropbox/Programming/Latex/pruebita/untitled.tex
    Undefined symbols for architecture x86_64:
      "_main", referenced from:
          start in crt1.10.6.o
    ld: symbol(s) not found for architecture x86_64
    collect2: ld returned 1 exit status
    [Finished in 0.1s with exit code 1]

    Any help?

    • What happens before you get this error? Try to compile your untitled.tex from the command line (in Terminal) by typing

      latexmk untitled.tex

      while in the directory where the file is, or type the complete path like so:

      latexmk /Users/Rocela/Desktop/Dropbox/Programming/Latex/pruebita/untitled.tex

      If this does not work, you may need to add the TeX Live folder to your $PATH variable or reinstall TeX Live.

  4. This tutorial was easy to follow and so glad that you have this resource available Thanks Chaning!

  5. Andre Gomes says:

    Love the tutorial! However I am having a problem with saving the file. I first started with Sublime 3 and when I try to save the file it states “unable to save – does not have permission”. I thought it was a SL 3 error so I switched to sublime 2 and did the whole process again but now it just states it can’t save the file. Please help! Thanks!

  6. I got an error:

    “Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo.”

    I’m not sure what this means. How do I fix this? I never saw A PDF viewer 🙁

    • I opened Xcode and agreed to fix that. Duh 😛

      But now I’m getting this error:

      ld: warning: ignoring file /Users/user/Desktop/first.tex, file was built for unsupported file format ( 0x20 0x5C 0x64 0x6F 0x63 0x75 0x6D 0x65 0x6E 0x74 0x63 0x6C 0x61 0x73 0x73 0x7B ) which is not the architecture being linked (x86_64): /Users/user/Desktop/first.tex
      Undefined symbols for architecture x86_64:
      “_main”, referenced from:
      implicit entry/start for main executable
      ld: symbol(s) not found for architecture x86_64
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      [Finished in 2.5s with exit code 1]

  7. Whenever I compile my .tex file, I get extra .aux, .log, and .synctex files in addition to my .pdf. How might I prevent these from being created? Thanks!

  8. Walker Huff says:

    I’ve been using Archimedes (which combines LaTeX and Markdown) for simpler, day-to-day editing needs:

    It’s nice not having to install 2 GB worth of LaTeX packages.

  9. When I try to build the pdf it says LateXTools: you need to migrate your preferences, how can I solve this? please help me

  10. Same issue as Ropanz. It’s just that one last step! How do I “migrate my preferences”? Also, since I’m trying to do this with an existing .tex file, is that going to give me another instruction to decipher?

    Thanks for the tutorial so far Chaning!

  11. I seemed to have solved the previous problem by going to Preferences>Package Settings>LaTeXTools>Reconfigure LaTeXTools and migrate settings.

    Unfortunately, now I’m getting the following new error:

    TraditionalBuilder: Invoking latexmk…


    Attempted command:latexmk -cd -e $pdflatex = ‘pdflatex -interaction=nonstopmode -synctex=1 $S %0’ -f -pdf first.tex
    Build engine: Traditional Builder

    I’ve looked through a few forums and can’t find an easy-to-comprehend fix for this. Does anyone know how to handle this?


  12. Brilliant thanks, this is by far the easiest way to use tex on osx.

  13. Thanks for the tutorial. I’ve been meaning to start using Sublime, but hadn’t found it easy to install the LatexTools package (until now!). I thought I would mention that the markdown for the most recent version of LatexTools says to use the Sublime presets in Skim (instead of pasting the code you provided). I did, and it works fine for me.

    Thanks again.

  14. Hello everyone!
    My question is this: How can I make tex-file auto-complete with tab or suggestion of possibilities in ST2?

  15. ascaredgirl says:

    Thanks for the tutorial!!
    Helped me for my assignments.

  16. I came out with the same error mentioned above:


    Attempted command:latexmk -cd -e $pdflatex = ‘pdflatex -interaction=nonstopmode -synctex=1 $S %0’ -f -pdf first.tex
    Build engine: Traditional Builder

    What helped me was to reinstall mactex (newer version than i had before). Now it compiles! Thank you for this! Do you also use ST2 for bibtex?

    • I currently use Zotero, though I highly recommend JabRef as well. A previous version of JabRef had Java version conflicts with my system, which is why I switched to Zotero. The browser integrations for Zotero are probably why I have not switched back to JabRef.

Leave a Reply