把上周在公司摸鱼玩的Go项目在家里的Mac电脑上跑一下,出现了下面的错误

1
2
3
$ go run .
# runtime/cgo
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

解决方案

1
2
$ xcode-select --install
$ sudo xcode-select -switch /