Mac VSCode 禁用GPU加速

文章目录
  1. 1. cd到VSCode执行程序所在目录
  2. 2. 将Electron(VSCode可以行程序)重名了为Electron.real
  3. 3. 在该目录新建一个文件名为Electron文本文件(没有后缀),并将下面的内容粘贴到文件里
  4. 4. 为Electron添加执行权限
  5. 5. 大功告成,现在直接打开vscode已经是禁用gpu了

某些老型号mac或者黑苹果使用VSCode时非常卡顿,有可能是GPU加速造成的。
原理用新的脚本替换vscode执行程序

cd到VSCode执行程序所在目录

cd /Applications/Visual\ Studio\ Code.app/Contents/MacOS/

将Electron(VSCode可以行程序)重名了为Electron.real

mv Electron Electron.real

在该目录新建一个文件名为Electron文本文件(没有后缀),并将下面的内容粘贴到文件里

#!/bin/bash
cd "/Applications/Visual Studio Code.app/Contents/MacOS"
"/Applications/Visual Studio Code.app/Contents/MacOS/Electron.real" --disable-gpu

"$@"

为Electron添加执行权限

chmod -R a+x Electron

大功告成,现在直接打开vscode已经是禁用gpu了

//可已经将自己创建的Electron文件备份到其他目录
//vscode升级后只需要执行第二部将Electron(VSCode可以行程序)重名了为Electron.real
//然后在把备份的Electron复制到该目录即可