# Setting up TeXstudio on Mac OS X 10.11 El Capitan

For a couple of years now, TeXstudio is my favorite IWE (Integrated Writing Environment) for LaTeX. Last year, I switched from Windows to OS X, but I didn’t take my LaTeX environment with me. Since I’m going to need LaTeX more often in the next time, I finally set it up on OS X 10.11 El Capitan. Unfortunately, this was not an easy task. And here’s why:

## Installing MacTeX and TeXstudio

The most common TeX distribution on Mac is MacTeX, and this distribution is incredibly huge: MacTeX’s installation package is about 2.3 gigabytes in size. The distribution contains all important TeX binaries, Ghostscript and some GUI tools for managing packets or modifying global TeX settings. (There’s also a way smaller distribution called BasicTeX, whose package is only 109 megabytes in size. However, I haven’t tested this distribution in combination with TeXstudio.)

Okay, installing a package is easy so far. But after you have installed MacTeX and TeXstudio, you will find that TeXstudio reports that it’s not able to find a LaTeX distribution. Huh, why is that?

## Keep Out, Super User!

“Don’t touch my system folders” — El Capitan

El Capitan’s all-new System Integrity Protection disallows modifying system folders such as /usr or /sbin even if you are granted super user rights. Those system folders can be modified with system rights only – for a good reason.

Hence, El Capitan doesn’t only prevent you from installing (linking) the binaries of MacTeX to the very common location of TeX distributions in /usr/texbin, it even breaks your existing installations of MacTeX if you upgrade from Yosemite or earlier versions of OS X to El Capitan.

TeXstudio looks for a tex distribution in the /usr/texbin folder only, and obviously won’t find it there. Therefore, you have to remap all commands usally found in /usr/texbin to the new location in /Library/TeX/texbin:

```latex       "/Library/TeX/texbin/latex" -synctex=1 -interaction=nonstopmode %.tex
dvips       "/Library/TeX/texbin/dvips" -o %.ps %.dvi
MakeIndex   "/Library/TeX/texbin/makeindex" %.idx
BiBTeX      "/Library/TeX/texbin/bibtex" %.aux
pdfLaTeX    "/Library/TeX/texbin/pdflatex" -synctex=1 -interaction=nonstopmode %.tex
dvipdf      "/Library/TeX/texbin/dvipdfm" %.dvi
dvipng      "/Library/TeX/texbin/dvipng" -T tight -D 120 %.dvi
Metapost    "/Library/TeX/texbin/mpost" --interaction nonstopmode
Asymptote   "/Library/TeX/texbin/asy" %.asy
```

If you installed MacTeX and experience problems with the GUI or command line tools (or both) because of missing paths or binary files, make sure you execute the Setup-2015.pkg package in the TeX folder in Applications. This fixes the paths to the TeX distribution in Library.

Note: You can also perform those steps on versions of OS X prior to El Capitan. In this case your TeX environment will continue to work after upgrading to El Capitan.

## Configuring TeXstudio for Git

Git is one of the most advanced version control systems around. However, TeXstudio only includes support for the older and less powerful Subversion (SVN). At the time of this writing, the feature request regarding Git support is more than four years old. But thanks to Git’s support for aliases, you can map SVN’s commit command ci to Git’s commit command (source):

`git config --global alias.ci "commit"`

Finally, you have to set git as the command for SVN and SVNADMIN. Now you can enable automated commits to keep intermediate results of your progress.

If you have another IWE or use other tools that don’t find your MacTeX installation, make sure to check out this guide by Herbert Schultz about upgrading your TeX environment to El Capitan.

Et voilà! Your TeX environment on El Captian is up and running.