Xetex stopped working after update to Mojave

I have a document that uses Xetex that compiled perfectly fine before I updated my OS to Mojave, but now won't compile at all. I've created this simple document in Texshop (v4.24):

%!TEX TS-program = latex
\documentclass{article}
\begin{document}
TESTING
\end{document}


When I typeset it, the output starts with:

This is /Library/TeX/texbin/simpdftex, Version 20070809
/Library/TeX/texbin/latex test.tex
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=latex)
restricted \write18 enabled.
entering extended mode

...and it compiles without problems. However, if I change the first line to

%!TEX TS-program = xelatex


(as in the much longer document I'm actually trying to compile), I get this:

This is XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2011/Fink)
restricted \write18 enabled.
(Fatal format file error; I'm stymied)

The log from when I compiled a file before Mojave says:

This is XeTeX, Version 3.1415926-2.3-0.9997.5 (TeX Live 2011/Fink) >(format=xelatex 2013.12.27)
21 JAN 2019 21:14
entering extended mode
restricted \write18 enabled.

...and then proceeds to run normally. These differences seem suspicious:

• the latex log mentions Tex Live 2018, which makes sense because I updated MacTex in the course of troubleshooting (2018 is now the default installation), but the xetex logs refer to Tex Live 2011
• the log for the successful xetex compilation refers to format=xelatex 2013.12.27, but the log for the unsuccessful complation does not.

I've tried sudo fmtutil-sys --all and fmtutil --all, but they didn't make any difference.

Can anyone help??

• Your xetex is from (TeX Live 2011/Fink) so there seems to be a PATH problem. How did you install TeX Live 2018? Was it via MacTeX? What is the PATH variable as shown in Terminal? Use echo \$PATH in Terminal to get it. – Herb Schulz Feb 19 at 17:31
• @Herb Yes, I installed TeX Live 2018 via MacTeX. At least I assume that's where it came from, seeing as I updated MacTeX the other day. Here's my PATH: /Applications/anaconda/envs/py36/bin:/Applications/anaconda/bin:/sw/bin:/sw/sbin:/Applications/anaconda/envs/py36/bin:/Applications/anaconda/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/opt/X11/bin – mangobingo Feb 19 at 20:01
• Please run which XeTeX to se where you are picking up the version from Fink. – Herb Schulz Feb 19 at 20:35
• Wow. It turned out that xetex was getting picked up from /sw/bin/xetex. I just prepended /Library/TeX/texbin to the PATH and now everything works perfectly. I have no idea how things got into this state, but my problem is solved. Thank you so much for taking the time to help! – mangobingo Feb 20 at 1:50