# fontconfig doesn't list/find XITS font even after updating config

I would like to use XITS/XITS Math within my LaTeX project (which uses XeTeX). Following the answers to this question, I created a file /etc/fonts/conf.avail/76-texlive-fonts.conf with the following content:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<dir>/usr/share/texlive/texmf-dist/fonts/opentype</dir>
<dir>/usr/share/texlive/texmf-dist/fonts/truetype</dir>
</fontconfig>


I had checked the above paths before to make sure that they are correct:

$ls -l /usr/share/texlive/texmf-dist/fonts/opentype/public/xits -rw-r--r-- 1 root root 111280 Nov 25 2016 xits-bolditalic.otf -rw-r--r-- 1 root root 151692 Nov 25 2016 xits-bold.otf -rw-r--r-- 1 root root 115536 Nov 25 2016 xits-italic.otf -rw-r--r-- 1 root root 248956 Nov 25 2016 xits-mathbold.otf -rw-r--r-- 1 root root 530128 Nov 25 2016 xits-math.otf -rw-r--r-- 1 root root 249372 Nov 25 2016 xits-regular.otf  Afterwards, I added a symlink to /etc/fonts/conf.d/: $ ls -l /etc/fonts/conf.d/76-texlive-fonts.conf
lrwxrwxrwx 1 root root 35 Jan 10 13:15 /etc/fonts/conf.d/76-texlive-fonts.conf -> ../conf.avail/76-texlive-fonts.conf


…and ran $fc-cache -fv. Its output, among others was: /usr/share/texlive/texmf-dist/fonts/opentype/public/xits: caching, new cache contents: 6 fonts, 0 dirs  Still, when I run fc-list | grep -i xits now, there is no output and compiling the below MWE gives the following error, as expected: … main.tex:11: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [\setmainfont{XITS}] main.tex:11: Font TU/XITS(0)/m/n/12=XITS at 12.0pt not loadable: Metric (TFM) file or installed font not found. [\setmainfont{XITS}] … main.tex:12: !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! [\setmathfont{XITS Math}] main.tex:12: Font TU/XITSMath(0)/m/n/12="XITS Math/OT" at 12.0pt not loadable: Metric (TFM) file or installed font not found. …  Here is the MWE: \documentclass[12pt,a4paper]{article} \usepackage{fontspec} \usepackage{unicode-math} \setmainfont{XITS} \setmathfont{XITS Math} \begin{document} Hello! Some math:$y = f(x)$\end{document}  I would very much appreciate any pointers to how I could fix or at least debug this problem! [UPDATE]: Turns out none of the fonts in /usr/share/texlive/texmf-dist/fonts/ show up in fc-list: The output of $ fc-list | grep /usr/share/texlive/texmf-dist/fonts is completely empty. Nevertheless, dozens of fonts get recognized when running sudo fc-cache -fv | grep /usr/share/texlive/texmf-dist/fonts. What is going on here?

I was being a moron: I ran fc-cache as root and fc-list as a regular user without realizing that the cache would then be built for the root user and not the regular user. Running both commands as regular user fixed the issue.