Visual Studio Code, how to disable the GPU

A while back, I dumped Sublime in favor of Visual Studio Code.

Sadly, Electron has a problem with some GPU like the one in my old MBP mid-2011, or the one in my Mac Mini 2012, causing the editor to be excessively unresponsive. I also have the same sluggishness on a “Hackintosh” using a GTX 1070 (using Nvidia’s Web Driver).

The best way I could describe this is it's like playing a game at 1 or 2 FPS.

Update: it seems to be caused by using a complex color profile, like those made using DisplayCAL. Falling back to a simple profile “fixes” the problem.

Simple “fix”

A basic fix is to launch VSCode in a shell with the --disable-gpu argument:

$ code --disable-gpu

or, using Finder,

$ open -a 'Visual Studio Code.app' --args --disable-gpu

But this quickly becomes irritating.

It is possible to replace the executable inside the application with a shell script, and direct Finder to launch that instead. However this breaks the “Open With” contextual menu, and draging a file onto the Dock's icon doesn’t work anymore.

A better fix

I prefer to launch things with Alfred most of the time.

Since there's no preference to make this option permanent, the next best thing is to call app.disableHardwareAcceleration().

We add this in the file /Applications/Visual Studio Code.app/Contents/Resources/app/out/main.js.

Find app.once("ready",, find the semi-colon (“;“) just before that, then add app.disableHardwareAcceleration();, producing something like this:

rDefinedLocale();app.disableHardwareAcceleration();userDefinedLocale.then(e=>{
e&&!nlsConfiguration&&(nlsConfiguration=getNLSConfiguration(e))}),app.once("ready",func

Once this is done, hardware “acceleration” should be permanently disabled.

In vim, if this makes things clearer :

  • /app.once + enter
  • F;aapp.disableHardwareAcceleration(); + esc
  • save (ZZ, or :wq)