June 18, 2019 · software

Enable/Disable Subpixel Antialiasing in VS Code

Starting with macOS Mojave, Apple disabled subpixel antialiasing across the entire operating system. However, you can actually enable it for specific apps through a hidden command, which is useful if you're using a non-Retina display (standard DPI). I find subpixel antialiasing easier on the eyes, especially during long coding sessions with Visual Studio Code.

This is the before-after comparison (only comparable on low DPI monitors):

antialiasing

This is the script to enable it for VS Code:

#!/usr/bin/env bash
defaults write com.microsoft.VSCode CGFontRenderingFontSmoothingDisabled 0
defaults write com.microsoft.VSCode.helper CGFontRenderingFontSmoothingDisabled 0
defaults write com.microsoft.VSCode.helper.EH CGFontRenderingFontSmoothingDisabled 0
defaults write com.microsoft.VSCode.helper.NP CGFontRenderingFontSmoothingDisabled 0

And this is how to disable it:

#!/usr/bin/env bash
defaults delete com.microsoft.VSCode CGFontRenderingFontSmoothingDisabled
defaults delete com.microsoft.VSCode.helper CGFontRenderingFontSmoothingDisabled
defaults delete com.microsoft.VSCode.helper.EH CGFontRenderingFontSmoothingDisabled
defaults delete com.microsoft.VSCode.helper.NP CGFontRenderingFontSmoothingDisabled

You can also enable/disable subpixel antialiasing across the whole OS by following the StackExchange discussion here, but the procedure may change in the future.

Update June 2020: This no longer works.