简体   繁体   English

卸载Xcode(使用Android Studio)后,如何在Mac上继续使用Git?

[英]How to continue using Git on mac after uninstalling Xcode (with Android Studio)?

I have installed Git on my Mac. 我已经在Mac上安装了Git。 When I do a "whereis" in my terminal the route is: 当我在终端中执行“ whereis”操作时,路线为:

/usr/bin/git

I use Android Studio and the GitHub desktop client and had no problems so far. 我使用Android Studio和GitHub桌面客户端,到目前为止没有任何问题。

Previously I had installed Xcode, but I uninstalled it a week ago. 以前我已经安装了Xcode,但是一周前我将其卸载了。 Since then, Android Studio does not detect Git, I get the following error: 从那时起,Android Studio不会检测到Git,我收到以下错误消息:

xcrun: error: active developer path ("/Volumes/Vega/Applications/Xcode.app/Contents/Developer") does not exist, use xcode-select --switch path/to/Xcode.app to specify the Xcode that you wish to use for command line developer tools (or see man xcode-select ) xcrun:错误:活动的开发人员路径(“ /Volumes/Vega/Applications/Xcode.app/Contents/Developer”)不存在,请使用xcode-select --switch path/to/Xcode.app指定所需的Xcode用于命令行开发人员工具(或参见man xcode-select

Android Studio shows the same executable path to Git indicating the terminal ( /usr/bin/git ), but when I click on the "test" button it displays the same error. Android Studio显示了指向Git的相同可执行路径,指示了终端( /usr/bin/git ),但是当我单击“测试”按钮时,它显示了相同的错误。

I do not handle very well Git from the terminal, always use the desktop client. 我在终端上对Git的处理不太好,始终使用桌面客户​​端。

What do I have to do to continue using Git on my Android studio (or anywhere) now that I uninstalled Xcode? 卸载Xcode后,我该怎么做才能继续在Android Studio(或其他任何地方)上使用Git?

I searched for information but I can not fix it. 我搜索了信息,但无法解决。

If commands sudo xcode-select --reset and xcode-select --install does not work for you and you dont want to install xcode then just reinstall git manually via brew : 如果命令sudo xcode-select --resetxcode-select --install对您不起作用,并且您不想安装xcode,则只需通过brew手动重新安装git:

brew reinstall git

And open new terminal session 并打开新的终端会话

Worked for me 为我工作

尝试这个 :

xcode-select --install

You should install the Xcode command line tools at the very least. 您至少应该安装Xcode命令行工具。 If you're not a registered Apple Developer, however, I'm not sure how to get hold of them if Xcode is not installed. 但是,如果您不是注册的Apple Developer,那么如果未安装Xcode,我不确定如何获取它们。 If you are a registered Apple Developer, you can get them from the Apple Developer Download site . 如果您是注册的Apple Developer,则可以从Apple Developer下载站点获得它们。 It' probably best to re-install Xcode and you will get them as a system update. 最好重新安装Xcode,您将获得它们作为系统更新。

That will give you a minimal development environment, and if you need additional tools/libraries you can build them via Macports with the command line tools installed. 这将为您提供一个最小的开发环境,如果您需要其他工具/库,则可以通过安装了命令行工具的Macports来构建它们。

sudo xcode-select --reset

如果已经安装了命令行工具,会将您的路径重置为默认值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM