Tools

Make Your Monospaced Font Nerdy with Nerd Fonts Patcher

jin@catsriding.com
Nov 2, 2023
Published byJin
Make Your Monospaced Font Nerdy with Nerd Fonts Patcher

Enable Nerd Fonts with Nerd Fonts Patcher

When using tools like Powerlevel10k or Oh My Zsh, you may encounter missing icons or broken Powerline symbols in your terminal or editor interface. These issues typically occur because the default monospaced font lacks the necessary glyphs. To fix this and unlock a richer set of developer icons, using Nerd Fonts is highly recommended.

make-your-monospaced-font-nerdy-with-nerd-fonts-patcher_00.png

The official Nerd Fonts website offers a wide selection of pre-patched fonts. However, if your preferred font isn’t included, you can use the Nerd Fonts Patcher to patch it yourself.

1. Overview of Nerd Fonts Patcher

Nerd Fonts Patcher is a CLI tool that adds developer-focused glyphs—such as Powerline symbols, Devicons, and font logos—into existing font files. It enables custom fonts to properly render icons used in prompts, status bars, file trees, and other parts of modern development environments.

When paired with tools like Powerlevel10k or Oh My Zsh, patched fonts ensure that all visual elements display correctly, preventing broken symbols or empty boxes. Nerd Fonts Patcher is especially useful when your preferred font isn't available in the official Nerd Fonts collection, allowing you to patch and use it exactly the way you want.

2. Setting Up the Nerd Fonts Patcher on macOS

To patch a font using Nerd Fonts Patcher, you’ll need Python and the FontForge library installed on your system. macOS includes Python by default, but depending on your setup, you may need to adjust or reinstall it.

2-1. Check Python installation

Verify that Python is available by running:

Terminal
$ python --version
Python 3.12.4

If this command returns an error or an older version, install the latest version using Homebrew:

Terminal
$ brew install python@3.12

To ensure compatibility with scripts that expect the python command (instead of python3), create a symbolic link:

Terminal
$ ln -s "$(brew --prefix)/bin/python3" /usr/local/bin/python

2-2. Install FontForge

FontForge is required to apply the glyph patches. Install it using Homebrew:

Terminal
$ brew install fontforge

2-3. Download Nerd Fonts Patcher

Visit the Nerd Fonts website and download the Font Patcher source package.

make-your-monospaced-font-nerdy-with-nerd-fonts-patcher_02.png

2-4. Extract and inspect the patcher

After downloading, unzip the archive and navigate into the folder:

Terminal
$ unzip ~/Downloads/FontPatcher.zip -d ~/Downloads/FontPatcher/
$ cd ~/Downloads/FontPatcher

You should see files like font-patcher, readme.md, and a few folders like src/.

Terminal
$ exa -alh
Permissions Size User       Date Modified Name
drwxr-xr-x@    - catsriding 10 Aug 13:27   bin/
.rwxr-xr-x@ 117k catsriding 12 Apr 23:28   font-patcher*
.rw-r--r--@  422 catsriding 12 Apr 23:28   readme.md
drwxr-xr-x@    - catsriding 10 Aug 13:27   src/

2-5. Confirm CLI availability

Run the CLI with the help flag to verify that it works:

Terminal
$ ./font-patcher -h
Nerd Fonts Patcher v3.0.2 (4.4.0) (ff 20230101)
usage: font-patcher [-h] [-v] [-s] [-l] [-q] [-c] [--careful] [--removeligs] [--postprocess [POSTPROCESS]] [--configfile [CONFIGFILE]] [--custom [CUSTOM]]
                    [-ext [EXTENSION]] [-out [OUTPUTDIR]] [--glyphdir [GLYPHDIR]] [--makegroups [{-1,0,1,2,3,4,5,6}]] [--variable-width-glyphs]
                    [--has-no-italic] [--progressbars | --no-progressbars] [--debug [{0,1,2,3}]] [--dry] [--xavgcharwidth [XAVGWIDTH]] [--fontawesome]
                    [--fontawesomeextension] [--fontlogos] [--octicons] [--codicons] [--powersymbols] [--pomicons] [--powerline] [--powerlineextra]
                    [--material] [--weather]
                    font

Nerd Fonts Font Patcher: patches a given font with programming and development related glyphs

* Website: https://www.nerdfonts.com
* Version: 3.0.2
* Development Website: https://github.com/ryanoasis/nerd-fonts
* Changelog: https://github.com/ryanoasis/nerd-fonts/blob/-/changelog.md

positional arguments:
  font                  The path to the font to patch (e.g., Inconsolata.otf)

options:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -s, --mono, --use-single-width-glyphs
                        Whether to generate the glyphs as single-width not double-width (default is double-width)
  -l, --adjust-line-height
                        Whether to adjust line heights (attempt to center powerline separators more evenly)
  -q, --quiet, --shutup
                        Do not generate verbose output
  -c, --complete        Add all available Glyphs
  --careful             Do not overwrite existing glyphs if detected
  --removeligs, --removeligatures
                        Removes ligatures specificed in JSON configuration file
  --postprocess [POSTPROCESS]
                        Specify a Script for Post Processing
  --configfile [CONFIGFILE]
                        Specify a file path for JSON configuration file (see sample: src/config.sample.json)
  --custom [CUSTOM]     Specify a custom symbol font, all glyphs will be copied; absolute path suggested
  -ext [EXTENSION], --extension [EXTENSION]
                        Change font file type to create (e.g., ttf, otf)
  -out [OUTPUTDIR], --outputdir [OUTPUTDIR]
                        The directory to output the patched font file to
  --glyphdir [GLYPHDIR]
                        Path to glyphs to be used for patching
  --makegroups [{-1,0,1,2,3,4,5,6}]
                        Use alternative method to name patched fonts (recommended)
  --variable-width-glyphs
                        Do not adjust advance width (no "overhang")
  --has-no-italic       Font family does not have Italic (but Oblique)
  --progressbars        Show percentage completion progress bars per Glyph Set (default)
  --no-progressbars     Don't show percentage completion progress bars per Glyph Set
  --debug [{0,1,2,3}]   Verbose mode (optional: 1=just to file; 2*=just to terminal; 3=display and file)
  --dry                 Do neither patch nor store the font, to check naming
  --xavgcharwidth [XAVGWIDTH]
                        Adjust xAvgCharWidth (optional: concrete value)

Symbol Fonts:
  --fontawesome         Add Font Awesome Glyphs (http://fontawesome.io/)
  --fontawesomeextension
                        Add Font Awesome Extension Glyphs (https://andrelzgava.github.io/font-awesome-extension/)
  --fontlogos, --fontlinux
                        Add Font Logos Glyphs (https://github.com/Lukas-W/font-logos)
  --octicons            Add Octicons Glyphs (https://octicons.github.com)
  --codicons            Add Codicons Glyphs (https://github.com/microsoft/vscode-codicons)
  --powersymbols        Add IEC Power Symbols (https://unicodepowersymbol.com/)
  --pomicons            Add Pomicon Glyphs (https://github.com/gabrielelana/pomicons)
  --powerline           Add Powerline Glyphs
  --powerlineextra      Add Powerline Glyphs (https://github.com/ryanoasis/powerline-extra-symbols)
  --material, --materialdesignicons, --mdi
                        Add Material Design Icons (https://github.com/templarian/MaterialDesign)
  --weather, --weathericons
                        Add Weather Icons (https://github.com/erikflowers/weather-icons)

This will print a detailed list of all options available with the patcher, including icon sets such as:

  • --powerline, --powerlineextra
  • --devicons, --fontawesome, --material, --weather, etc.
  • --complete: patches all available glyph sets

The font-patcher command accepts a font file as a positional argument and generates a patched version containing the selected glyphs.

3. Patch your font with Nerd Fonts Patcher

In this section, we'll apply Nerd Fonts glyphs to a custom font — in this case, my favorite, MonoLisa font. If the font you want isn’t available on the Nerd Fonts website, you can patch it yourself using the Nerd Fonts Patcher.

Here’s how to patch all font variants at once:

Terminal
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-Black' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-Black.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-BlackItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-BlackItalic.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-Bold' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-Bold.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-BoldItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-BoldItalic.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-ExtraBold' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-ExtraBold.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-ExtraBoldItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-ExtraBoldItalic.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-ExtraLight' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-ExtraLight.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-ExtraLightItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-ExtraLightItalic.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-Light' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-Light.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-LightItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-LightItalic.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-Medium' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-Medium.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-MediumItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-MediumItalic.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-Regular' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-Regular.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-RegularItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-RegularItalic.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-SemiBold' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-SemiBold.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-SemiBoldItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-SemiBoldItalic.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-Thin' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-Thin.ttf &
./font-patcher -c --makegroups 1 --name 'MonoLisaNerds-ThinItalic' -out ~/Downloads/MonoLisaNerds ~/Downloads/MonoLisa/MonoLisa-ThinItalic.ttf
  • -c: Adds all available development glyphs (Devicons, Powerline, Codicons, etc.).
  • --makegroups 1: Adjusts the font naming convention. In this case, it appends "Nerd Font" to the original family name.
  • --name: Overrides the default name for the patched font. This is useful for organizing your fonts by style and avoiding conflicts.
  • -out: Defines the output directory for the patched font files.
  • The last argument is the path to the source .ttf file you want to patch.

Once complete, you'll find the patched files in the output directory:

Terminal
$ cd ~/Downloads/MonoLisaNerds
$ exa -alhF
.rw-r--r--  2.2M catsriding 10 Aug 15:22   MonoLisaNerds-Regular.ttf
.rw-r--r--  2.2M catsriding 10 Aug 15:22   MonoLisaNerds-RegularItalic.ttf
...

To use the fonts system-wide, install them on macOS by double-clicking the .ttf files or dragging them into Font Book.

 Warning
Be sure to remove any previously installed versions of the same font family to avoid rendering conflicts.

Once installed, patched fonts will render all glyphs correctly in tools like Powerlevel10k, eza, or fzf.

make-your-monospaced-font-nerdy-with-nerd-fonts-patcher_01.png

Here's a sample output using eza with the --icons option:

Terminal
$ eza -alhF --icons
.rw-r--r--@ 8.2k catsriding 30 Jan 13:08   .DS_Store
drwxr-xr-x@    - catsriding  1 May 11:31   .git/
.rw-r--r--    49 catsriding  6 Mar 02:20   README.md
.rw-r--r--   482 catsriding  4 Dec         build.gradle
...

All icons are displayed properly using the custom-patched MonoLisa Nerd Font, including:  󰨇   󰬷   󰸏  .

4. Wrapping up

Whether you're using Powerlevel10k, Oh My Zsh, or simply want to enhance your terminal and editor with better visual clarity, Nerd Fonts provide a practical solution. While pre-patched fonts are available on the Nerd Fonts website, patching your own font with Nerd Fonts Patcher gives you full control over the typeface and style you prefer.

Patching a font may require some setup — Python, FontForge, and command-line tools — but once configured, it enables a consistent and polished experience across your development tools.

Now your favorite monospaced font doesn’t have to miss out on the nerdy fun. 🤓