Change fonts in Safari

When I published this site for the first time, I was painfully unsatisfied by its rendering: the font was ugly. Since I’m too lazy to modify theme, I’ve searched for font-family into css files and I found a reassuring monospace. The problem was in the browser itself.

I’ve tried to search in the Safari preferences pane with no luck, so I’ve googled it.

Stack Exchange, as usual, came in my help.

There are a couple of undocumented options for Safari font definition.

Here’s the one for monospaced font and its size:

defaults write com.apple.Safari \
  com.apple.Safari.ContentPageGroupIdentifier.WebKit2FixedFontFamily \
  'Iosevka Nerd Font'
defaults write com.apple.Safari \
  com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFixedFontSize \
  14

You can even change the default font (and its size):

defaults write com.apple.Safari \
  com.apple.Safari.ContentPageGroupIdentifier.WebKit2StandardFontFamily \
  Helvetica
defaults write com.apple.Safari \
  com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFontSize \
  16

Now I can read my site without puke on the laptop screen.


P.S. You should definitely try the Iosevka font family. Best monospaced font ever.