1.) Download a Nerd Font
2.) Unzip and copy to ~/.fonts
3.) Run the command fc-cache -fv
to manually rebuild the font cache
1.) Download a Nerd Font
2.) Unzip and copy to ~/.fonts
3.) Run the command fc-cache -fv
to manually rebuild the font cache
#!/bin/bash declare -a fonts=( BitstreamVeraSansMono CodeNewRoman DroidSansMono FiraCode FiraMono Go-Mono Hack Hermit JetBrainsMono Meslo Noto Overpass ProggyClean RobotoMono SourceCodePro SpaceMono Ubuntu UbuntuMono ) version='2.1.0' fonts_dir="${HOME}/.local/share/fonts" if [[ ! -d "$fonts_dir" ]]; then mkdir -p "$fonts_dir" fi for font in "${fonts[@]}"; do zip_file="${font}.zip" download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${zip_file}" echo "Downloading $download_url" wget "$download_url" unzip "$zip_file" -d "$fonts_dir" rm "$zip_file" done find "$fonts_dir" -name '*Windows Compatible*' -delete fc-cache -fv
This script was the only thing that actually worked for me. Thank you.
Thanks!
@donovan awesome script, TY.
+1 to @donovan 's script, wonderful and easy to read
What is ~/.fonts? Directory?
@p6002 yep, it's a directory
works! thanks
thanks
Well, I'm a beginner in this art of creating scripts, so the script below is certainly not optimized or error-proof, I used a good part of @donovan's code, I just changed the use of wget to a git clone using the sparse option, guaranteeing the most current version of the font and the install described in the official documentation, it can also be changed to the powershell installation but as it is not my case at the moment, I did not use it. In fact, bandwidth consumption is higher because it downloads the repository (even if only partially), something that direct download does not, so there is a certain amount of "waste".
#!/bin/bash
declare -a fonts=(
# BitstreamVeraSansMono
# CodeNewRoman
# DroidSansMono
FiraCode
# FiraMono
# Go-Mono
# Hack
# Hermit
JetBrainsMono
# Meslo
# Noto
# Overpass
# ProggyClean
# RobotoMono
# SourceCodePro
# SpaceMono
# Ubuntu
# UbuntuMono
)
fonts_dir="${HOME}/.local/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
echo -e "\e[0;32mScript:\e[0m \e[0;34mClonning\e[0m \e[0;31mNerdFonts\e[0m \e[0;34mrepo (sparse)\e[0m"
git clone --filter=blob:none --sparse [email protected]:ryanoasis/nerd-fonts
cd nerd-fonts
for font in "${fonts[@]}"; do
echo -e "\e[0;32mScript:\e[0m \e[0;34mClonning font:\e[0m \e[0;31m${font}\e[0m"
git sparse-checkout add "patched-fonts/${font}"
echo -e "\e[0;32mScript:\e[0m \e[0;34mInstalling font:\e[0m \e[0;31m${font}\e[0m"
./install.sh "${font}"
done
echo -e "\e[0;32mScript:\e[0m \e[0;34mCleaning the mess...\e[0m"
cd ../
rm -rf nerd-fonts```
Still waiting for proper documentation how to install it
Thanks, but I have already made several approaches to these fonts, hours-long approaches.
There were always unfixable problems, errors, bad characters. Which was frustrating enough, since it's just a theme and should work with a single command.
For now I'm watching the project and waiting for someone to write proper documentation with steps on how to install this theme. Currently it's such a mess there that I think only the author can use it.
It took an embarrassingly long amount of time for me to realize nerd-fonts
the Github repo already comes with an install.sh
script.
git clone --depth 1 https://github.com/ryanoasis/nerd-fonts.git # warning: takes a while
cd nerd-fonts/
./install.sh FiraCode
(or whatever other font you want -- or all of them if you just run ./install.sh
by itself.
Thank you, @hiAndrewQuinn
@hiAndrewQuinn's example should probably be on the main README considering the amount of us that have ended up here.
I still waiting for proper documentation how to install and use it.
In the meantime, I started the rack, I learned how to use Docker, I run services through Docker Compose and several VMs without any problems. But I still can't install the fonts...
@Sephyros absolutely amazing 👍
Hi guys, after testing several linux distros and having to configure and customize my terminal and shell every time, I decided to create this script that downloads directly from the Nerd Fonts repository, use it as you like and if you want to contribute something, feel free.
The documentation on how to use the script is in the readme:
https://github.com/mcarvalho1/Nerd-fonts-Downloader-Script
Thanks @mcarvalho1!
Thanks @mcarvalho1 !
Hi guys, after testing several linux distros and having to configure and customize my terminal and shell every time, I decided to create this script that downloads directly from the Nerd Fonts repository, use it as you like and if you want to contribute something, feel free.
The documentation on how to use the script is in the readme: https://github.com/mcarvalho1/Nerd-fonts-Downloader-Script
This is beautiful.
I made a small, but useful to me, change to @donovan code. I added code to look up the latest version of nerd fonts and download those.
#!/bin/bash
declare -a fonts=(
BitstreamVeraSansMono
CascadiaCode
CodeNewRoman
DroidSansMono
FiraCode
FiraMono
Go-Mono
Hack
Hermit
JetBrainsMono
Meslo
Noto
Overpass
ProggyClean
RobotoMono
SourceCodePro
SpaceMono
Ubuntu
UbuntuMono
)
version=$(curl -s 'https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest' | jq -r '.name')
fonts_dir="${HOME}/.local/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
for font in "${fonts[@]}"; do
zip_file="${font}.zip"
download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/${version}/${zip_file}"
echo "Downloading $download_url"
wget "$download_url"
unzip "$zip_file" -d "$fonts_dir"
rm "$zip_file"
done
find "$fonts_dir" -name 'Windows Compatible' -delete
fc-cache -fv
had to move the font in /usr/share/fonts
Another variant, which installs fonts passed on args (allows to install new fonts without modifying the script) and download directly the latest version:
#!/bin/bash
set -euo pipefail
fonts_dir="$HOME/.local/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
for font in "$@"; do
zip_file="$font.zip"
download_url="https://github.com/ryanoasis/nerd-fonts/releases/latest/download/$zip_file"
echo "Downloading $download_url"
wget -O "/tmp/$zip_file" "$download_url"
unzip "/tmp/$zip_file" -d "/tmp/$font/"
mv /tmp/$font/*.ttf $fonts_dir
rm "/tmp/$zip_file"
rm "/tmp/$font/" -rf
done
fc-cache -fv
Check out Nerd Font Downloader (nfdl): https://github.com/rubiin/nfdl
It requires node(js) to run.
It presents a (fuzzy searchable) list of Nerd Fonts which you can choose from to download.
It tries to put the font in the right place for user fonts (per operating system).
On Linux and macOS it will even try to run fc-cache for you, after downloading.
Check out Nerd Font Downloader (nfdl): https://github.com/rubiin/nfdl It requires node(js) to run. It presents a (fuzzy searchable) list of Nerd Fonts which you can choose from to download. It tries to put the font in the right place for user fonts (per operating system). On Linux and macOS it will even try to run fc-cache for you, after downloading.
this npm helped fix a missing icon issue on ubuntu 24.04
Thank you!
I made a small, but useful to me, change to @donovan code. I added code to look up the latest version of nerd fonts and download those.
#!/bin/bash
declare -a fonts=( BitstreamVeraSansMono CascadiaCode CodeNewRoman DroidSansMono FiraCode FiraMono Go-Mono Hack Hermit JetBrainsMono Meslo Noto Overpass ProggyClean RobotoMono SourceCodePro SpaceMono Ubuntu UbuntuMono )
version=$(curl -s 'api.github.com/repos/ryanoasis/nerd-fonts/releases/latest' | jq -r '.name') fonts_dir="${HOME}/.local/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then mkdir -p "$fonts_dir" fi
for font in "${fonts[@]}"; do zip_file="${font}.zip" download_url="github.com/ryanoasis/nerd-fonts/releases/download/${version}/${zip_file}" echo "Downloading $download_url" wget "$download_url" unzip "$zip_file" -d "$fonts_dir" rm "$zip_file" done
find "$fonts_dir" -name 'Windows Compatible' -delete
fc-cache -fv
I made him better.
#!/bin/bash
declare -a fonts=(
BitstreamVeraSansMono
CascadiaCode
CodeNewRoman
DroidSansMono
FiraCode
FiraMono
Go-Mono
Hack
Hermit
JetBrainsMono
Meslo
Noto
Overpass
ProggyClean
RobotoMono
SourceCodePro
SpaceMono
Ubuntu
UbuntuMono
)
version=$(curl -s 'https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest' | jq -r '.name')
if [ -z "$version" ] || [ "$version" = "null" ]; then
version="v3.2.1"
fi
echo "latest version:$version"
fonts_dir="${HOME}/.local/share/fonts"
#fonts_dir="/usr/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
for font in "${fonts[@]}"; do
ls ="${font}.zip"
download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/${version}/${zip_file}"
echo "Downloading $download_url"
wget "$download_url"
unzip "$zip_file" -d "$fonts_dir"
rm "$zip_file"
done
find "$fonts_dir" -name 'Windows Compatible' -delete
fc-cache -fv
You've got a typo in your script that's causing an error. On the line where you have ls ="${font}.zip", you're mistakenly using the ls command instead of assigning the zip file name to a variable. This incorrect usage leads to the script failing to locate the font file, resulting in a "No such file or directory" error when it tries to download and unzip the font. By correcting that line to zip_file="${font}.zip", you'll properly assign the zip file name to the zip_file variable, allowing the download URL to be constructed correctly and the font installation to proceed without issues.
Script below with fixes and works on 24.04
#!/bin/bash
declare -a fonts=(
BitstreamVeraSansMono
CascadiaCode
CodeNewRoman
DroidSansMono
FiraCode
FiraMono
Go-Mono
Hack
Hermit
JetBrainsMono
Meslo
Noto
Overpass
ProggyClean
RobotoMono
SourceCodePro
SpaceMono
Ubuntu
UbuntuMono
)
version=$(curl -s 'https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest' | jq -r '.name')
if [ -z "$version" ] || [ "$version" = "null" ]; then
version="v3.2.1"
fi
echo "latest version: $version"
fonts_dir="${HOME}/.local/share/fonts"
#fonts_dir="/usr/share/fonts"
if [[ ! -d "$fonts_dir" ]]; then
mkdir -p "$fonts_dir"
fi
for font in "${fonts[@]}"; do
zip_file="${font}.zip"
download_url="https://github.com/ryanoasis/nerd-fonts/releases/download/${version}/${zip_file}"
echo "Downloading $download_url"
wget "$download_url"
unzip -o "$zip_file" -d "$fonts_dir" # Added the -o option here to allow replacing
rm "$zip_file"
done
find "$fonts_dir" -name 'Windows Compatible' -delete
fc-cache -fv