Today, I needed to pick up a few fonts from Google Fonts. Usually, I’m just linking to them from my code, but this time I needed to download and install them.
Installing fonts is a pain in the ass. It annoys me, so I went looking for a better solution. Something I was unaware of is that Google has all of their fonts easily accessible within a GitHub repo. After digging a bit more, I found an auto-installer script that will handle the entire library. Here’s how to run it:
Instructions
- Open your terminal. If you don’t know how to, do some Googling.
- Run this command:
curl https://raw.githubusercontent.com/qrpike/Web-Font-Load/master/install.sh | sh
- Pleasantly wait for the script to run.
Yup. That’s it. Every font from Google Fonts is now installed. Celebrate, drink a beer, and figure out what you’re going to do with all of that extra free time.
For the paranoid (and those who know better than to run anonymous code), the source to the script is available on GitHub. I’ve also taken the liberty of embedding it below as well. Enjoy.
#!/bin/bash # For OS X-based systems. clear echo "Installing all Google Web Fonts onto your Mac" echo "Downloading the fonts..." cd ~/Documents/ curl -L https://github.com/google/fonts/tarball/master -o master.tar.gz echo "Extracting the fonts..." mkdir -p goog-fonts/fonts tar -zxf master.tar.gz -C goog-fonts/fonts cd goog-fonts cd fonts find . -mindepth 2 -type f -print -exec mv {} . \; rm -R -- */ rm *.txt rm *.json rm *.csv rm *.md rm *.html rm *.py rm AUTHORS rm CONTRIBUTORS cd .. mv fonts/* /Library/Fonts/ echo "Fonts installed; Cleaning up files..." cd ~/Documents/ rm -f master.tar.gz rm -rf goog-fonts echo "All done! All Google Fonts installed."
Credit: Web-Font-Load by Quinton Pike