解决macOS下VS Code启动时报错的问题
问题复现
MAC升级到macOS Monterey,每次重启电脑之后打开VS Code,右下角都有一个错误弹窗:Unable to resolve your shell environment in a reasonable time. Please review your shell configuration.
而且重启电脑后,打开terminal时,也有很长时间卡住的现象(这时zsh的标题窗口一直卡在xcodebuild上)
解决问题
由于terminal卡在xcodebuild上,推断是系统升级后xcode的问题,百度了一番,说是内置git的问题,解决方案如下:
通过homebrew安装git
1
brew install git
编辑
.zshrc
,将新装的git路径加入PATH中1
vim ~/.zshrc
.zshrc文件内容如下:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15export ZSH="/Users/williampeng/.oh-my-zsh"
ZSH_DISABLE_COMPFIX="true"
DISABLE_AUTO_UPDATE="true"
ZSH_THEME="ys"
DISABLE_AUTO_UPDATE="true"
#plugins=(git osx brew)
plugins=(osx brew)
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/sbin:/usr/local/opt/node@14/bin:/Users/williampeng/.composer/vendor/bin:/usr/local/Cellar/git/2.36.1/bin:$PATH"
export LDFLAGS="-L/usr/local/opt/openssl/lib"
source $ZSH/oh-my-zsh.sh
zmodload zsh/zprof
#export JAVA_HOME=/Applications/Android\ Studio.app/Contents/jre/jdk/Contents/Home
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles