Toggling font anti-aliasing of code view in XCode

There is no any setting option to toggle the font anti-alising (or font smooth) in XCode preferences.

XCode Font Preferences

Although there is no such setting, we can still set the font size threshold for the anti-aliasing behavior. This threshold in XCode setting defines whether the XCode editor apply anti-alias font smoothing to the code size.

We can disable the XCode anti-aliasing by applying the following command in Terminal.

defaults write com.apple.xcode AppleAntiAliasingThreshold 24

The last number is the threshold number. XCode smoothes all text with size bigger than the number, here it is font size 24.

In my case, I’m using font size 13 so setting the threshold to any number bigger than 13 works for me. And I believe 24 works for most programmers.

To enable the font anti-alising, just set the threshold to a small number, like the following command.

defaults write com.apple.xcode AppleAntiAliasingThreshold 4

The following screenshot compares the XCode showing Envy Code R 13 in both anti-aliasing disabled and enabled.

XCode Anti-aliasing Compare

The screenshot may show that text without anti-aliasing is a little bit hard to read. It is because the text here is in an image and not at the optimal font size. You can try toggling the anti-aliasing and read it in XCode. For those font type that designed for terminal or code reading, the non anti-aliasing one is more readable.

Updated:

For XCode4, use com.apple.dt.xcode AppleAntiAliasingThreshold instead.