Fixing Terrible Blurry Font Rendering Issue in macOS Mojave #OneDevMinute
Ahmad Awais ⚡️

Ahmad Awais ⚡️ @ahmadawais

About: VP of DevRel RapidAPI ❯ Award-winning Web Developer NodeCLI.com ❯ Google Dev Expert Web tech ❯ 2x GitHub Stars Award ❯ WordPress Core Dev ❯ TEDx Speaker ❯ "awesome example for devs" — Satya Nadella

Location:
San Francisco Bay Area
Joined:
Feb 19, 2017

Fixing Terrible Blurry Font Rendering Issue in macOS Mojave #OneDevMinute

Publish Date: Sep 25 '18
58 23

Just updated to macOS Mojave only to find out that there is a terrible font rendering issue for almost all the ElectronJS based apps like VSCode my code editor of choice.

After researching a little bit, less to my surprise, I found out that Apple has disabled Subpixel antialiasing for text in macOS Mojave. It's gone.

Little more research led to a fix, all you have to do is open up your Terminal application (COMMAND (⌘) + SPACE then search for Terminal) and run the following command.

defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO

5 Macos Mojave Font Rendering Issue Fix

This will lead to the font smoothing to be enabled — especially for non-retina external monitors. You'll thank me later. You need to sign out and sign back in or restart your Mac before you can see your changes after running this command. That's pretty much all.

🧐

Explanation: What's Happening In there?!

Some folks in the comments asked about how I stumbled upon this fix, so for the sake of technical know-how, I am updating this post with more details.

🎯 Apple's macOS normally has a set of defaults that you can change programmatically. I have such an opinionated workflow for whenever I install my OS from scratch. That's a story for another day.

🤖 I remember in the past, with High Sierra, I had to enable subpixel font rendering on non-Apple LCDs. That was the AppleFontSmoothing option which I set to true, or one could directly add -int 1 for that option.

🤔 I was unable to find that setting in macOS Mojave defaults. I kept looking in there. Especially in the Apple Global Domain settings, since that's where the old setting was.

🙃 Aha! I found a new setting in there, it's called CGFontRenderingFontSmoothingDisabled — it's quite evident what this setting does. Disables the rendering of smooth fonts. It was set to 1 which means it was set to TRUE or YES.

Macos Mojave Cgfontrenderingfontsmoothingdisabled 1

So, all I had to do to try my luck was to disable this font smoothing disabler, i.e. enable to font smoothing on non-Apple/non-retina LEDs. For that I wrote this following command:

defaults write -g CGFontRenderingFontSmoothingDisabled -bool FALSE

  • defaults — access the Mac OS X user defaults system
  • −g | −globalDomain | NSGlobalDomain — Specifies the global domain. ’-g’ and ’-globalDomain’ may be used as synonyms for NSGlobalDomain
  • CGFontRenderingFontSmoothingDisabled — the setting which I wanted to disable to enable the font smoothing
  • −bool [ean] — Allows the user to specify a boolean as the value for the given preference key. The value must be TRUE/YES or FALSE/NO

I ran this command, checked if it worked, by logging out and in, and boy it did. Super happy. I wish Apple fixes this instead of disabling this option altogether in the near future updates.

Macos Font Fix Cgfontrenderingfontsmoothingdisabled

🎉 Since I am a big fan of VSCode I did a before/after --diff of the defaults and it seems the setting is now set to 0 and it works so hurrah!

Macos Mojave Defaults Changed Font Fixed[/ecko_fullpage_image]

⚠️ Some folks also recommended enabling the font smoothing option in the General font settings but that didn't work for me. It was already enabled and did nothing to improve the situation.

Font Blur Issue Macos Mojave

Peace! ✌️

This was first posted at Fix macOS Mojave Font Rendering Issue

Comments 23 total

  • Brian Kephart
    Brian KephartSep 26, 2018

    After reading this, I noticed that the fonts on my website were thicker in Safari than they were before the update on my retina-equipped MBP. Other browsers were unaffected. I turned OFF font smoothing, and things returned to normal. Weird.

  • АнонимSep 26, 2018

    [deleted]

    • АнонимSep 26, 2018

      [deleted]

    • Maedah Batool 👩‍💻
      Maedah Batool 👩‍💻Sep 26, 2018

      What a bad a comment. 😧

      I was right there when Ahmad was getting frustrated on that distorted font, honestly, for some reason, my laptop had no issue and he had that issue. And the happiness that aha moment — then he ended up wasting a lot of his time, he said:

      Entire day ruined :(

      and then he wrote a blog post to save others some time… ✅

  • АнонимSep 26, 2018

    [deleted]

    • АнонимSep 26, 2018

      [deleted]

      • АнонимSep 26, 2018

        [deleted]

        • Ahmad Awais ⚡️
          Ahmad Awais ⚡️Sep 26, 2018

          Hate much?! Wish I had the time to fight with haters. I don't. It's a simple setting. I detailed the process of how I found it, you can go and hate all the world you want! Not going to work on me. We are not playing that game.

          • АнонимSep 26, 2018

            [deleted]

            • Sloan the DEV Moderator
              Sloan the DEV ModeratorSep 26, 2018

              Hey Stanislas,

              Accusing someone of plagiarism is a pretty serious accusation. We recognize that both of your articles are similar, but the solution given in both articles is specific. It seems sensible that two articles focused on the same solution would share similar formats.

              You both acknowledge doing outside research in your respective articles. We think it's most likely that you were both inspired by the same reference further upstream. Above all, we wished that this exchange had happened with more good faith and a willingness to provide the benefit of the doubt.

              This is also fundamentally unknowable because there is unclear evidence. Given that Ahmad is a regular contributor in good standing, we don't believe a declarative public accusation is warranted or acceptable.

              We're going to remove your comments, but you're free to get in touch via yo@dev.to.

  • Jhegs
    JhegsSep 26, 2018

    (Instead to come and claim for credits here, like others) I came here to say "thank you", I often use an external monitor and I was having this weird issue.

  • Maedah Batool 👩‍💻
    Maedah Batool 👩‍💻Sep 26, 2018

    Thank you, Ahmad, for fixing it. Sorry, it ruined your day but it was so much fun to see you so frustrated and when your arms were up in the air with the Aha moment! 🤣

  • HeejongCho
    HeejongChoSep 27, 2018

    Thank you!

  • Maetrik/Ben
    Maetrik/BenOct 4, 2018

    This worked for me until today, now the fonts are to thin again, even if the value says 0.
    I can see it very clearly in iTerm/Terminal.

    Edit: NVM, this is a iTerm2 issue.

Add comment