ryanwhocodes Aug 26, 2018 · 3 min read

Nerd Fonts - How to install, configure, and remove programming fonts on a Mac

How to set up your terminal and shell with Nerd Fonts for extra icons, and also remove them.

Patched programming fonts, such as Nerd Fonts, are those that have been amended to include extra icons related to coding. One reason developers use them is to enhance their terminal prompt, for example as part of the theme Powerlevel9k for the Z shell.

This tutorial will explain how to install Nerd Fonts, configure your terminal to use them, as well as how to remove them for your computer.

Contents

Why use Nerd Fonts?

One popular patched font is Nerd Fonts, which aggregates icons from a variety of sources. > Nerd Fonts is a project that patches developer targeted fonts with a high number of glyphs (icons). Specifically to add a high number of extra glyphs from popular ‘iconic fonts’ such as Font Awesome ➶, Devicons ➶, Octicons ➶, and others. — Nerd Fonts on GitHub

This means you can install Nerd Fonts and then easily be able to use all the extra icons, such as on website or in your terminal.

Install Nerd Fonts

Nerd Fonts gives you many options for downloading it, a full list can be seen on its GitHub page. Here is the option to install using homebrew.

brew tap caskroom/fonts
brew cask install font-hack-nerd-font

Now if you look in the folder you just installed it in, you will see it listed there.

cd ~/Library/Fonts
ls

Hack Italic Nerd Font Complete.ttf
Hack Regular Nerd Font Complete.ttf
Hack Bold Italic Nerd Font Complete.ttf
Hack Bold Nerd Font Complete.ttf        

Configure your terminal

Once you have downloaded Nerd Fonts, you can then set your terminal to use it.

Setup iTerm2 to use the font by going to:

iTerm2 -> Preferences -> Profiles -> Text -> Font -> Change Font

Set up Nerd Fonts in your iTerm2 Preferences

Select the font Hack Regular Nerd Font Complete and adjust the size if your want to. Also check the box for Use a different font for non-ASCII text and select the font again. It should be displaying the new font and icons in the prompt.

Remove Nerd Fonts

To remove Nerd Fonts via the command line, first go into the fonts folder it was installed into.

cd ~/Library/Fonts

Check that it is there using the list command ls.

Run the homebrew command to uninstall it.

brew cask uninstall font-hack-nerd-font

Check it has been removed successfully using ls again. It should not be listed in this folder any more.

After this you may then want to reconfigure another font for your terminal.

iTerm2 -> Preferences -> Profiles -> Text -> Font -> Change Font

Find out more

The Nerd Fonts website has more information on the many icons it includes and the ways you can use them. If you want to learn how to install it for another platform besides a mac then a good starting point for this is the Nerd Fonts GitHub page. Below are some links to check out some of my other tutorials.