I have a web application that uses the browser's default monospace font. It's set up that way so that the user can pick their own. In Chrome, this works well, as it's easy to set the default fonts, but in Safari, they removed the option.

Is there some way for users to set default fonts in Safari?


There are still unexposed preferences for changing the default fonts and font sizes:

defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2StandardFontFamily Georgia
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFontSize 16
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2FixedFontFamily Menlo
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFixedFontSize 14

Another option is to edit the CSS file that defines the default styles (look in Preferences > Advanced > Stylesheet), adding something like this, for example:

@font-face {
   font-family: monospace;
   src: local('Menlo');

That rule makes any element that uses font-family: monospace (as well as elements like <pre> and <code> by default) use Menlo. Just change the font name (being careful to keep the enclosing quotes) to whatever you prefer.

  • 1
    Suddenly, it doesn't work for additional fonts installed via Font Book on Mojave (10.14.2) – Ilya Vassilevsky Feb 7 at 11:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .