Manually Install a Nerd Font on arch Linux for use with a terminal emulator.
NOTE: This method bypasses the method recommended on the Arch Wiki, which uses pacman package manager to manage installed fonts. This is useful for situations were you want to use a font (ie Nerd Font), that does not have a package readily available and you don’t feel like building one for it. If you would like to create a font package see: Font package guidelines, Installing Fonts and PKGBUILD on the arch wiki.
This guide is specific to Arch Linux, but the same method should work with other Distros.
- Install of Linux (I use arch: https://archlinux.org/)
- xorg/Window Manager (I will use i3 for this example)
- Terminal Emulator (I will use alacritty for this example)
- Text Editor (I use Micro, highly recommend for quick edits in the terminal)
- An archive utility for .zip files, such as unzip
1. Download Nerd-Font:
Go to nerdfonts.com/ and hit downloads. This will give you a page where you can preview different fonts.
Once you find a font you like, hit Download on the font to save it as a .zip.
- Refrain from unzipping it in your downloads directory, compressed font folders can contain many different files. (You’ll want to move it to where it needs to be installed first to keep things easy.)
2. Setup the File Path:
Most modern Linux Distros use the fontconfig library to search specific directories for new fonts when the distribution is booted up:
Default Font Paths for fontconfig:
- The first path is for a global install for all users, the second is for a local install for one specific user (‘ ~ ‘ would be their home directory).
- Local install usually makes the most sense. This is because most config files are saved locally for each specific user anyways, and it prevents having to mess with any privileges.
Because fontconfig searches recursively through directories, we can create sub-directories to keep our font files organized and it will still find them:
First we want to check for the ~/.local/share/fonts/ directory:
from the user's home directory:
As we can see from this image our .local/share/ does not contain a /fonts/ directory, so we will make one real quick:
Now we can cd into it and create a sub-directory to copy our font files into, I’m just going to make one called ‘nerd-fonts’:
3. Extract Files and Install:
Now that we have our directory set-up we can locate our .zip file and copy it over:
cp ~/Downloads/DaddyTimeMono.zip ~/.local/share/fonts/nerd-fonts/
Next we’ll navigate over to our nerd-fonts folder and extract the file:
If we list our nerd-fonts directory we should see the extracted files ending in ‘.ttf’:
Now that your font files are in a directory recognized by fontconfig they should be loaded automatically on boot and made available to applications in your window manager.
To reload the fonts without rebooting you can run as root:
and restarting the x-server. But I recommend also rebooting.
After rebooting you can run:
fc-match DaddyTimeMono -a
where ‘DaddyTimeMono’ is replaced by the name of the font you installed. You should see all the files from step 3 in the list:
This means that fontconfig has recognized the newly installed fonts.
I have another post that goes over how to configure the terminal emulator Alacritty to use a new font here. If you are using another terminal emulator, refer to the documentation to use the newly installed font.
Watch out for problems with spacing or missing characters. You can test the symbols that are patched into nerd fonts by going to the website nerdfonts.com/, clicking the icons search button, and copying different symbols into your terminal:
ctrl + c
ctrl + Shift + v
If you are experiencing problems with display:
- Try installing a different font and see if the problem persists
- Sometimes installing it globally into ‘/usr/share/fonts/’ can work if a program is having problems with permissions
- Make sure your locale is configured properly