74

I'm using the latest version of MacTeX 2013 on OS X 10.8.4. All of my TeX Live packages are fully up-to-date. TeX Live also lists the fontawesome package as installed.

I'm trying to use the FontAwesome font with XeLaTeX or LuaLaTeX and getting font-not-found errors. The exact message is:

kpathsea: Running mktexmf FontAwesome
! I can't find file `FontAwesome'.

There's a longer traceback which I am omitting for brevity. Let me know if it's needed to resolve this problem.

I have already tried running the following commands, to no avail:

sudo -H mktexlsr
sudo -H updmap-sys

Other than the above two commands, this is a 100% new out-of-the-box installation, with no modifications whatsoever.

Here's a minimal broken example:

\documentclass{article}
\usepackage{fontawesome}

\begin{document}
\faTwitter
\end{document}

How can I add this missing font?

Edit (Q1 2021): Please see Justin Curry's answer regarding an update to the package name from fontawesome to fontawesome5.

5
  • 2
    FontAwesome can be found at CTAN at this location. I am not sure how you can add this to your OS X 10.8.4, I do not use this OS or MacText. But did you take a look at this one?
    – Masroor
    Commented Sep 12, 2013 at 4:02
  • FontAwesome provides an OTF font, which apparently is not being copied to the correct font directory. This post suggests how you might proceed
    – Llaves
    Commented Sep 12, 2013 at 5:28
  • @Llaves - It's probably not so much an issue of the font file not being copied to the correct directory but of the font not having been "activated" correctly. Just copying a font file to the user's ~/Library/Fonts directory doesn't activate it, at least not in a way suitable for use under MacOSX. Under MacOSX, the easiest way I know to "activate" a font is to load it in the FontBook application and click on the "Install Font" button. Doing so also copies the font file to ~/Library/Fonts...
    – Mico
    Commented Sep 12, 2013 at 6:45
  • @Mico Luaotfload doesn’t care for a font’s “activation state” (whatever that is). As long as it is in a system path the font will be indexed. I suggest that OP remove the package and copy the otf files into the system font path manually. Then run luaotfload-tool --update and retry. Commented Sep 12, 2013 at 8:36
  • @phg -- I may not have expressed myself sufficiently clearly. As I noted in the "full" answer, LuaLaTeX was able to compile the MWE even before the otf version of the font was downloaded and "officially activated". It was XeLaTeX that couldn't compile the MWE before the font was properly activated.
    – Mico
    Commented Sep 12, 2013 at 11:38

11 Answers 11

39

On my MacBook (running MacTeX 2013 under MacOSX 10.7.5), your example compiles correctly under LuaLaTeX if I add the instruction \usepackage{fontspec}:

enter image description here

% !TEX TS-program = lualatex
\documentclass[border=2pt]{standalone}
\usepackage{fontspec}
\usepackage{fontawesome}
\begin{document}
\faTwitter
\end{document}

Addendum: After I downloaded the OpenType version of this font -- BTW, the version at https://fontawesome.com/docs seems to be slightly newer than the one on the CTAN -- and "activated" it by opening it in the FontBook application and clicking on the "Install" button, the MWE above also compiles correctly under XeLaTeX. This is not exactly surprising, I suppose, as Xe(La)TeX depends heavily on the underlying operating system for activities such as loading fonts.


Addendum, mid-February 2020: The demo document shown above continues to work correctly under LuaLaTeX when run under TeXLive2019 or MacTeX2019. To get it to compile under XeLaTeX, you will probably need to insert the instruction

\defaultfontfeatures{Path = /usr/local/texlive/2019/texmf-dist/fonts/opentype/public/fontawesome/}

between the instructions \usepackage{fontspec} and \usepackage{fontawesome}.

The file FontAwesome.otf that's distributed with MacTeX2019 has version number 4.6.3. There is a slightly newer version of the OpenType font file -- version 4.7.0, to be precise -- on github. Both 4.6.3 and 4.7.0 date back to 2016. A minor caveat: I haven't actually tested out the slightly newer version of FontAwesome.otf. However, I believe it should be compatible with the fontawesome package.

14
  • 5
    \usepackage{fontspec} did the trick. I'm actually using the moderncv package, which recently added support for FontAwesome icons. I'll contact the author and suggest he add the fontspec package to his template.
    – knite
    Commented Sep 12, 2013 at 18:09
  • 1
    Hi, can you update your answer with tex.stackexchange.com/a/472090/166923 ?
    – ColonD
    Commented Mar 8, 2019 at 9:30
  • 1
    @ColonD - Ok. Am away from my Mac laptop all day -- will update this answer tonight.
    – Mico
    Commented Mar 8, 2019 at 9:40
  • 3
    The link should now be github.com/FortAwesome/Font-Awesome/blob/v4.7.0/fonts/… since Font Awesome 5 isn’t compatible with fontawesome package. Commented Feb 14, 2020 at 9:48
  • 1
    I didn’t notice that it dates back to 2016! They seems to have stopped maintenance on that branch. Maybe the MacTex one is easier then. Commented Feb 14, 2020 at 10:26
33

On Ubuntu, you can install fontawesome using the following command:

sudo apt-get install texlive-fonts-extra 
3
  • 2
    The other answers confused me. What is really missing is the system font, which can be installed like this.
    – Kyle
    Commented Sep 26, 2020 at 18:53
  • 8
    -1GB after installation :( Commented Oct 17, 2020 at 21:31
  • 9
    apt-get install fonts-font-awesome was enough for me, and it's only 1.4MB. Commented Jul 12, 2021 at 9:20
25

If anyone wants to get this working with xelatex without installing the font into your system, see section 4.2 By file name of the fontspec.pdf manual:

[Loading the font by file name] is also necessary in XeTeX when loading OpenType fonts that are present within your TEX distribution, such as /usr/local/texlive/2013/texmf-dist/fonts/opentype/public. Fonts in such locations are visible to XeTeX but cannot be loaded by font name, only file name; LuaTEX does not have this restriction.

Since fontawesome.sty simply references the font by name:

% definition of \FA as a shortcut to load the Font Awesome font
\newfontfamily{\FA}{FontAwesome}

We have to set the default Path to locate the font, before loading fontawesome:

\documentclass{article}
\usepackage{fontspec}

\defaultfontfeatures{
    Path = /usr/local/texlive/2013/texmf-dist/fonts/opentype/public/fontawesome/ }
\usepackage{fontawesome}

\begin{document}
\faTwitter
\end{document}

You may have to change Path depending on where fontawesome is installed. Assuming you're using TeX Live, you can find the relative path to the font file by running:

tlmgr info --list fontawesome

Output:

package:     fontawesome
category:    Package
shortdesc:   Font containing web-related icons.
longdesc:    The package offers access to the large number of web-related icons provided by the included font. The package requires the package, fontspec, running under XeTeX or LuaTeX.
installed:   Yes
revision:    31020
sizes:       doc: 173k, run: 101k
relocatable: Yes
cat-version: 3.1.1
cat-date:    2014-04-26 20:05:48 +0200
cat-license: other-free
collection:  collection-fontsextra
Included files, by type:
run files:
  texmf-dist/fonts/opentype/public/fontawesome/FontAwesome.otf
  texmf-dist/tex/latex/fontawesome/fontawesome.sty
doc files:
  texmf-dist/doc/latex/fontawesome/README details="Readme"
  texmf-dist/doc/latex/fontawesome/fontawesome.pdf
  texmf-dist/doc/latex/fontawesome/fontawesome.tex
0
22

You just need to install (by double clicking) the FontAwesome.otf that comes with MacTeX on the macOs system fonts. (The new fonts downloaded from github didn't work for me.)

My FontAwesome.otf is in:

/usr/local/texlive/2018/texmf-dist/fonts/opentype/public/fontawesome

You can locate your file with:

tlmgr info --list fontawesome
4
  • 9
    you need to be higher, this is the best method to get the correct version of the font
    – ColonD
    Commented Mar 8, 2019 at 9:24
  • 1
    This is the only answer that helped me to get Developer CV working. Thanks!
    – user190341
    Commented Aug 19, 2019 at 19:25
  • 1
    This answer did it for me. I used lualatex and ran it twice. First time it compiled the font, then the second time it picked itup. However, I imagine I could add more search paths to the ${TEXMFSYSVAR}/fonts/conf/fonts.conf.
    – FilBot3
    Commented Oct 1, 2019 at 1:37
  • 1
    GitHub still works, but you need a different link because the developers decide to make breaking change in Font Awesome 5. Font Awesome 4 is still available on GitHub via github.com/FortAwesome/Font-Awesome/blob/v4.7.0/fonts/…. Commented Feb 14, 2020 at 9:47
12

Ultimately, you need /path/to/FontAwesome.otf to be produced by \newfontfamily\FA[Path=/path/to/,Extension=.otf]{FontAwesome}.

Note this answer assumes you didn't add the TeX Live fonts to the system environment variables such that they are found when fontspec searches the system fonts. (either because you don't know how or because it isn't practical e.g. multi-client Version Control System situation where you can't guarantee that every client has the same system environment variables).

Assuming you are using XeLaTeX: To minimize maintenance with each sequential TeX Live release (2015,2016, etc.), I chose to add \defaultfontfeatures{Extension = .otf} rather than provide an explicit path.

This is because XeLaTeX automatically loads $(kpsewhich -var-value TEXMFSYSVAR)/fonts/conf/texlive-fontconfig.conf into its path.

texlive-fontconfig.conf from TeX Live 2015

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

With each release, this gets updated, so you don't have any maintenance costs ;)

So you only need to add the extension parameter to \newfontfamily{\FA}{FontAwesome} indirectly this way. This is of course provided that the fonts you're using are OTF.

\documentclass{article}
\usepackage{fontspec}

\defaultfontfeatures{Extension = .otf}% adds .otf to end of path when font loaded without ext parameter e.g. \newfontfamily{\FA}{FontAwesome} > \newfontfamily{\FA}{FontAwesome.otf}
\usepackage{fontawesome} % Relevant path loaded (TeX Live 2015 expansion): /usr/local/texlive/2015/texmf-dist/fonts/opentype/FontAwesome causing missing font

\begin{document}
\faTwitter This is a test.
\end{document}

As a fun exercise to prove your understanding, you could create a document like this:

\listfiles
\documentclass{article}
\usepackage{fontspec}

%\defaultfontfeatures{
%  Extension = .otf
%}
%\usepackage{fontawesome}
\newfontfamily\fatest{FontAwesome.otf} % Explicitly provide .otf
%or
%\newfontfamily\fatest[Extension=.otf]{FontAwesome}


\begin{document}
%\faTwitter This is a test
{\fatest\char"F099} This is a test
\end{document}

This works because the following are equivalent:

  • \newfontfamily\fatest{FontAwesome.otf}
  • \newfontfamily\fatest[Extension=.otf]{FontAwesome}
  • \defaultfontfeatures{Extension = .otf}\newfontfamily{\fatest}{FontAwesome}

because they all yield a platform-independent paths.

e.g. Unix-based:

/usr/local/texlive/2015/texmf-dist/fonts/opentype/FontAwesome.otf

and fontspec will try to load a font by adding each prefix listed in this xml file:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
ANYTHING IN HERE GETS PREFIXED to the font file
</fontconfig>

See tex.stackexchange.com/a/313886/13552

2
  • with your command \newfontfamily\fatest{FontAwesome.otf}, how can I join it with FA[Path=\@fontdir]... where I have an example which originally used \newfontfamily\FA[Path=\@fontdir]{FontAwesome}
    – lukeg
    Commented Apr 2, 2017 at 12:12
  • 1
    @lukeg I am not sure what you mean by "join it", but I assume you mean "make it compatible with". Without knowing what your \@fontdir contains, I would venture to guess that you just need to add ,Extension = .otf as a parameter to \newfontfamily\FA. Do not forget to add a trailing slash to the path! If your \@fontdir contains a path other than the built-in TeX Live FontAwesome.otf path, then you'd need to put a copy of FontAwesome.otf at that path. Ultimately, you need /path/to/FontAwesome.otf to be produced by \newfontfamily\FA[Path=\@fontdir,Extension=.otf]{FontAwesome}. Commented Apr 3, 2017 at 14:48
6

I ran into this issue recently (Jan 2021) and after installing Font Awesome 5's fonts via Font Book and doing everything I thought was necessary, there turned out to be a one character (!) solution.

Replace

\usepackage{fontawesome}

with

\usepackage{fontawesome5}

That's it. I was led to this after seeing Franklin Yu's comment above to the accepted answer, which remarks that Font Awesome 5 is not compatible with the fontawesome package. Why they didn't just update the fontawesome and had to create a whole new fontawesome5 package is beyond me.

https://ctan.org/pkg/fontawesome5?lang=en

1
  • 1
    Just updated my answer to include this!
    – knite
    Commented Jan 14, 2021 at 1:19
4

I guess it might be caused by missing a step of post-installation of TeX Live. From the instruction provided tug.org, it would be like this below.

  1. Make sure you have imported TeX Live binaries to your PATH. If not, you may refer this section.
  2. Check the value of TEXMFSYSVAR.

    $ kpsewhich --var-value TEXMFSYSVAR
    
  3. Copy TEXMFSYSVAR/fonts/conf/texlive-fontconfig.conf to your font config directory (e.g. to /etc/fonts/conf.d/09-texlive.conf). Or if you have not enough privileges to do, you may copy to your HOME direcotory as well, e.g.

    $ cp `kpsewhich --var-value TEXMFSYSVAR`/fonts/conf/texlive-fontconfig.conf \
      ~/.fonts.conf
    
  4. Run fc-cache to refresh fontconfig

    $ fc-cache -fv
    

    If you copy the conf file to a system-wide directory, e.g. /etc/fonts/conf.d as mentioned before, probably you need to run

    $ sudo fc-cache -fsv
    

    or

    # fc-cache -fsv
    
  5. Eventually, check fc-list to make sure you've installed fontawesome

    $ fc-list | grep 'fontawesome'
    
3

On Ubuntu 19.04:

sudo apt install texlive-fonts-recommended

Then use fontawesome5:

 \documentclass{article}
 \usepackage{fontawesome5}

 \begin{document}
 \faTwitter
 \end{document}
2

The fontawesome package when using XeLaTeX assumes that the file FontAwesome.otf exists in the right place, but recent versions of FontAwesome, will install Font Awesome 5 Free-Regular-400.otf and Font Awesome 5 Free-Solid-900.otf.

I thought about playing with defaultfontFeatures[FontAwesome] after \usepackage{fontspec} and before \usepackage{fontawesome}, but a much simpler approach was to find an version of FontAwesome.oft and simply install that on my Mac.

1
  • This is a useful answer for anyone who did install the current Font Awesome desktop files. Just to add to it, the last Font Awesome 4 release (4.7.0) provides a FontAwesome.otf. Commented Apr 1, 2019 at 13:25
1

There are some excellent answers already. Below are some steps that worked for me on macOS BigSur in March 2021 with TexLive 2020, with the intent of compiling with pdfLatex. It follows closely this 2016 step-by-step guide: https://theoryl1.wordpress.com/2016/01/15/fontawesome-in-pdftex/ and I am posting here for reference for my future self and hopefully others:

    \documentclass{article}
    \usepackage{hyperref}
    \usepackage{fontawesome}
    \usepackage{verbatim}
    \usepackage{listings}% verbatim with breaklines option
    \lstset{%
      language=[LaTeX]TeX,
      basicstyle=\ttfamily,
    }


    \begin{document}
    Font Awesome is a font that provides scalable icons that can easily be used in text. To install fontawesome, follow these steps:

    \begin{enumerate}
    \item 
    Download the zip file with \verb|wget| or any other method:

    \qquad \verb|wget http://mirrors.ctan.org/fonts/fontawesome.zip|

    If you do not have \verb|wget| installed, you may install it via \verb|homebrew| or \verb|macports| or some other method. Example:

    \begin{lstlisting}[breaklines]
       ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    \end{lstlisting}

    \qquad \verb|brew install wget|

    \item
    Unzip the zip file and save its contents in \verb|~/texmf/|:

    \qquad \verb|unzip fontawesome.zip|

    \qquad \verb|mkdir -p ~/texmf/|

    \qquad \verb|mkdir -p ~/texmf/doc/fonts/fontawesome/|

    \qquad \verb|mkdir -p ~/texmf/fonts/enc/dvips/fontawesome/|

    \qquad \verb|mkdir -p ~/texmf/fonts/map/dvips/fontawesome/|

    \qquad \verb|mkdir -p ~/texmf/fonts/opentype/public/fontawesome/|

    \qquad \verb|mkdir -p ~/texmf/fonts/tfm/public/fontawesome/|

    \qquad \verb|mkdir -p ~/texmf/fonts/type1/public/fontawesome/|

    \qquad \verb|mkdir -p ~/texmf/tex/latex/fontawesome/|

    \qquad \verb|cd fontawesome|

    \qquad \verb|mv README.md ~/texmf/doc/fonts/fontawesome/|

    \qquad \verb|mv doc/* ~/texmf/doc/fonts/fontawesome/|

    \qquad \verb|mv enc/* ~/texmf/fonts/enc/dvips/fontawesome/|

    \qquad \verb|mv map/* ~/texmf/fonts/map/dvips/fontawesome/|

    \qquad \verb|mv opentype/* ~/texmf/fonts/opentype/public/fontawesome/|

    \qquad \verb|mv tfm/* ~/texmf/fonts/tfm/public/fontawesome/|

    \qquad \verb|mv type1/* ~/texmf/fonts/type1/public/fontawesome/|

    \qquad \verb|mv tex/* ~/texmf/tex/latex/fontawesome/|

    \qquad \verb|cd ..|

    \qquad \verb|rm -rf fontawesome|

    \item 
    Update the font map:

    \qquad \verb|updmap -sys|

    \item 
    Check that the map file has been registered.

    \qquad \verb|kpsewhich fontawesome.map|

    \item
    Run \verb|pdfLaTeX| on this minimal example. The output below should look like an automobile and a bicycle.

    \begin{verbatim}
    \documentclass{article}
    \usepackage{fontawesome}
    \begin{document}
    \faAutomobile\qquad\faBicycle
    \end{document}
    \end{verbatim}
    \faAutomobile\qquad\faBicycle

    \end{enumerate}

    \end{document}
0

For Alpine Linux, since the package ttf-font-awesome only has Font Awesome 5, you need to manually download Font Awesome 4 from

https://github.com/FortAwesome/Font-Awesome/blob/v4.7.0/fonts/FontAwesome.otf

and place it in folder /usr/share/fonts/X11/OTF. You can replace the tag 4.7.0 with latest release in 4.x branch.

Alternatively, you can also install the ttf-font-awesome-4 package from testing repository. (I have no idea why the package never made it to stable.)

1
  • ? This works for me, why downvote? Commented Feb 15, 2020 at 6:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .