升级Mojave后终端报错解决方法

Macos升级至Mojave后,在终端下执行git操作时,突然出现如下报错:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk'
[master 039153a] Site updated: 2019-12-19 16:13:38
3 files changed, 10 insertions(+), 10 deletions(-)
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk'
git: error: unable to read SDK settings for '/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk'

看报错内容应该是Macos升级后,Xcode下的CommandLineTools报错,更新下CommandLineTools就好了。

1
xcode-select --install

再试一下:

1
hexo d

可以了:

1
2
3
4
5
6
7
INFO  Deploying: git
INFO Clearing .deploy_git folder...
INFO Copying files from public folder...
INFO Copying files from extend dirs...
[master a984907] Site updated: 2019-12-19 16:26:37
11 files changed, 709 insertions(+), 28 deletions(-)
INFO Deploy done: git