# 升级macOS之后运行程序报错"missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcru"

我的macOS操作系统，从 11.1 升级到 11.2 之后，发现运行一些工具命令，例如 `git` 出现报错:

```
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
```

这是因为 Xcode Command-line Tools 需要升级

* 打开一个终端窗口执行以下命令

```
xcode-select --install
```

* 在弹出窗口确认下载安装command line tools
* 安装完成后需要重启终端窗口程序

> 如果上述方式不成功，则尝试强制reset:

```bash
sudo xcode-select --reset
```

> 如果上述安装失败，则需要在WEB浏览器中登陆Apple Developer网站，通过web安装 `Command Line Tools for Xcode 12.x`

## 参考

* [Mac OS: xcrun: error: invalid active developer path, missing xcrun](https://ma.ttias.be/mac-os-xcrun-error-invalid-active-developer-path-missing-xcrun/)
* [Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)](https://stackoverflow.com/questions/52522565/git-is-not-working-after-macos-update-xcrun-error-invalid-active-developer-pa)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://huataihuang.gitbook.io/cloud-atlas-draft/develop/mac/missing_xcrun.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
