Created
March 16, 2019 01:29
-
-
Save NorikDavtian/da09351b1ddf92d3f41d0d327278c751 to your computer and use it in GitHub Desktop.
Install Google fonts on Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl https://raw.githubusercontent.com/qrpike/Web-Font-Load/master/install.sh | sh |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# OS detection | |
osdetect=$(uname) | |
file_path="unknown" | |
if [[ "$osdetect" == 'Darwin' ]]; then | |
file_path="/Library/Fonts/" | |
elif [[ "$osdetect" == 'Linux' ]]; then | |
if [[ -d /usr/local/share/fonts/ ]]; then # Debian/Ubuntu and others. | |
file_path="/usr/local/share/fonts/" | |
elif [[ -d /usr/share/fonts/ ]]; then # OpenSUSE, Arch and other distros using this directory structure | |
sudo mkdir -p /usr/share/fonts/google/ | |
file_path="/usr/share/fonts/google/" | |
else # Fallback to installing fonts locally to the user, this is a safe bet, as several distros use this location. | |
mkdir -p ~/.fonts | |
file_path="~/.fonts/" | |
fi | |
fi | |
clear | |
echo "Installing all Google Web Fonts onto your System" | |
echo "Downloading the fonts..." | |
curl -L https://github.com/google/fonts/tarball/master -o /tmp/master.tar.gz | |
echo "Extracting the fonts..." | |
mkdir -p /tmp/goog-fonts/fonts | |
tar -zxf /tmp/master.tar.gz -C /tmp/goog-fonts/fonts | |
sudo find /tmp/goog-fonts/fonts/ -type f -name "*.ttf" -exec cp {} $file_path \; | |
echo "Fonts installed; Cleaning up files..." | |
rm -f /tmp/master.tar.gz | |
rm -rf /tmp/goog-fonts | |
echo "All done! All Google Fonts installed." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment