Skip to content
Thoughtful, detailed coverage of everything Apple for 33 years
and the TidBITS Content Network for Apple professionals
9 comments

Fix Your Fonts in Safari 6

As those who have installed Safari 6 (which comes with OS X 10.8 Mountain Lion) have discovered, the capability to set the browser’s default proportional font and the default fixed-width font has vanished from Safari’s preferences. As a result, some sites — specifically those that don’t set their own fonts using CSS (Cascading Style Sheets) — have begun appearing in Times and Courier, regardless of the default font settings a user may have set in a previous version of Safari.

Two solutions are available. The first is for users to create a default CSS file that Safari can use. This document, a text file with the file extension .css, can be stored anywhere; users simply need to point to it from the Style Sheet setting in Safari’s Advanced preferences. The contents of such a CSS document might look something like this:

body {
font-family: "Lucida Grande";
}
code, tt {
font-family: "Consolas";
font-size: 90%;
}

With the style sheet in place, after Safari is quit and relaunched it uses the specified fonts for body text and code text if a page’s HTML and CSS don’t specify otherwise.

However, one can also set Safari’s default fonts with shell commands using Terminal. Even though the user interface for setting these defaults has vanished, Safari still has them. The magic shell command is defaults and it takes four uses of it to set the defaults that one formerly set in Safari’s preferences. All one needs to do is open Terminal and issue the appropriate commands on the command line, and then quit and relaunch Safari.

For example, here is how I set my default fonts to Lucida Grande (proportional) and Consolas (fixed-width). First is the command to set the proportional font family (each of these is a single line):

defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2StandardFontFamily 'Lucida Grande'

Next is the command to set that font’s default size:

defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFontSize 14

Then one issues a similar command for the fixed-width font:

defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2FixedFontFamily 'Consolas'

And another for the fixed-width font size:

defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DefaultFixedFontSize 11

Granted, opening Terminal and pasting esoteric commands instead of using a graphical interface is not a usability win, but at least you need not be forced to view Times when you want Lucida Grande!

(A brief aside. I like to tweak how pages look, so although I can use Terminal to try out different default font and size combinations, I have found it more convenient to make a TextExpander shell script snippet that I can use to set and reset font defaults. The shell script snippet uses the same syntax as the Terminal commands but can be edited and invoked far more quickly. Plus, it makes a satisfying “pop” sound when it’s done.)

Subscribe today so you don’t miss any TidBITS articles!

Every week you’ll get tech tips, in-depth reviews, and insightful news analysis for discerning Apple users. For over 33 years, we’ve published professional, member-supported tech journalism that makes you smarter.

Registration confirmation will be emailed to you.

This site is protected by reCAPTCHA. The Google Privacy Policy and Terms of Service apply.

Comments About Fix Your Fonts in Safari 6