## ** TeX on Sierra **

### Herbert Schulz's "Updating for El Capitan and Sierra"

Last year, Herbert Schulz wrote a document about El Capitan. He later extended the report to cover Sierra. The Schultz report and this web page complement each other, and users are urged to read both. For the report, see Updating For El Capitan and Sierra.

### /usr/texbin and /Library/TeX/texbin

Important changes were made in 2015 for MacTeX. If you installed MacTeX-2015 or BasicTeX-2015, or if you install MacTeX-2016 or BasicTeX-2016, then you have these changes and you can skip this section.

If you had an old version of TeX Live (2014 or earlier) and then upgraded your operating system to Sierra, TeX will no longer work. Here's the reason. Older versions installed a symbolic link to the binaries, /usr/texbin. Apple doesn't allow anyone to write to the /usr directory in El Capitan or later. So in 2015, we introduced an equivalent link, /Library/TeX/texbin. All of our GUI applications now reconfigure themselves for this new link, which also works on the command line.

Therefore, to fix this problem install MacTeX-2016 or BasicTeX-2016.

Once MacTeX-2016 creates the new link, the link will also work with older versions of TeX Live, so you can still use TeX Live Utility to activate an older version of TeX Live if desired. In the TeX Live Utility "Configure" menu, select "Change Default TeX Live Version" and choose the version you want to make active.

You may have used the TeX Dist Pref Pane in the past to perform this function. We no longer distribute this Pane because Apple kept changing the rules for constructing Pref Panes. But we don't remove old panes; go to /Library/PreferencePanes and remove TeXDistPrefPane.prefPane is desired.

### XQuartz

The next issue concerns xdvi, a program which most Mac users never use. If you are among them, skip this section.

The windowing system on macOS is provided by Apple's Quartz. In Linux and Unix, windowing is provided by X-windows. There is an X-windows system for the Macintosh, known as X-Quartz. It is programmed by open source third parties, but until recently it was distributed by Apple. Today it is available at http://www.xquartz.org

The program xdvi in TeX Live is used to display dvi files on X-Windows. The version of xdvi provided by MacTeX-2016 works with X-Quartz 2.7.8, but not X-Quartz 2.7.9. If you update TeX Live 2016 using TeX Live Utility, the 64-bit version of xdvi will work with X-Quartz 2.7.9, but not X-Quartz 2.7.8. Luckily, version 2.7.9 runs on Snow Leopard and higher, and thus on all systems using 64 bit TeX binaries.

Therefore, we recommend that xdvi users on 64 bit machines update TeX Live with TeX Live Utility and then update X-Quartz to version 2.7.9 or higher.

### /etc/paths.d and /etc/manpaths.d

The next problem concerns typesetting from the command line using Terminal. If you never do that, or if your PATH in Terminal contains /Library/TeX/texbin, then you can skip this section.

When Sierra is installed from scratch on a new disk, rather than by updating an earlier version of macOS, the folders /etc/paths.d and /etc/manpaths.d are not created. MacTeX installs files in these locations which add /Library/TeX/texbin to shell paths. Consequently typesetting fails from the command line, although it works from GUI applications.

This problem was fixed in early October, and versions of MacTeX-2016 and BasicTeX-2016 downloaded after that time will not have this problem. If you have the problem, download and install the very small FixLink.pkg.

### PDF Background Color in TeXShop

(Added later: This problem is fixed in current developer betas of an Apple update to Sierra, and thus will probably be fixed in the next Sierra update. Stay tuned.)

The next problem concerns a few TeXShop users who set a different background color for the Preview Window. This fails in Sierra. Ignore this section if you use a different editor or don't set this color.

TeXShop is written with Cocoa, Apple's class library. A Cocoa program is written by "overriding" various class methods in the library. In particular, the PDFView object which draws PDF output has a routine called "drawPage:", which is called when the object draws a particular page of a document. The programmer can override this routine; a typical override might draw the background, and then call the original drawPage: to draw the text, and then in a final override draw items on top of the text.

In Sierra this routine is deprecated, and the header file says that it is replaced by a similar routine called "drawPage:withContext:". However, debugging shows that neither routine is called and consequently developers cannot modify the output of PDFView.

This feature cannot be repaired until Apple fixes their code. But LaTeX users can set the background another way, directly in LaTeX. We recommend the following technique. Near the top of the source in the document prelude, include the lines

      \newif\ifpreview
\previewfalse
\usepackage{xcolor}

Then in the body of the document right after "\begin{document}", add lines like
      \ifpreview {
\definecolor{personal}{rgb}{1.0, 1.0, 0.0}
\pagecolor{personal}
}
\fi

The "definecolor" call sets the background color by giving the red, green, and blue components of the color. Each component is a real number between 0 and 1. Users need to change these values to values they desire.

If LaTeX sets the background color during document composition, this color needs to be removed before printing because otherwise the printer will try to reproduce the color. Change \previewfalse to \previewtrue and typeset again to remove the background color.

### cocoAspell

cocoAspell is an addition to Apple's Spell Checking System by Anton Leuski. This addition understands LaTeX and therefore does not mark LaTeX control words as misspelled. It is highly recommended for all TeX users.

Pieces of cocoAspell broke in El Capitan, but users found workarounds to bring the spell checker back to life. Unfortunately, these workarounds failed in Sierra.

On November 8, Anton Leuski updated cocoAspell so all the pieces work on both El Capitan and Sierra, made the project open source, and released the source code. To get it in an Apple install package, go to http://people.ict.usc.edu/~leuski/cocoaspell/