Skip to content

Instantly share code, notes, and snippets.

@xanderificnl
Created February 10, 2022 15:19
Show Gist options
  • Save xanderificnl/6f4a10214034ee21ae87bc3bf632ecf4 to your computer and use it in GitHub Desktop.
Save xanderificnl/6f4a10214034ee21ae87bc3bf632ecf4 to your computer and use it in GitHub Desktop.
Install apple fonts
#!/usr/bin/env bash
#
# Easily install apple fonts
#
CACHE_DIR=/tmp/apple-fonts-cache
ZIP_BIN="7z -y"
mkdir ~/.fonts/
# Install dependencies on debian systems
test -d "$CACHE_DIR" || (grep debian /etc/os-release && sudo apt install -y wget p7zip-full)
for _font in "SF-Pro" "SF-Compact" "SF-Mono" "NY"; do
_path="$CACHE_DIR/$_font"
test -d "$_path" && continue
mkdir -p "$_path"
cd "$_path"
# Get the image
_image="$_font.dmg"
wget "https://devimages-cdn.apple.com/design/resources/download/$_image"
# Extract the image
$ZIP_BIN e $_image **/*.pkg
# Extract the package
$ZIP_BIN e "$(ls *.pkg)" Payload~
# Extract the fonts
$ZIP_BIN x Payload~
# Install fonts
mv Library/Fonts/* ~/.fonts/
done
fc-cache -fv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment