如何卸载 xcode 5 命令行工具? [英] How do I uninstall xcode 5 command line tools?

查看:58
本文介绍了如何卸载 xcode 5 命令行工具?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在周五升级到了 xcode 5 命令行工具.有些东西不能正常工作,我想回到最后的 4.x 版本 ox xcode.如何卸载 xcode 5 命令行工具?我在发行说明中没有看到任何内容.

I upgraded to xcode 5 Command Line Tools on Friday. Something is not working correctly and I want to go back to the last 4.x version ox xcode. How do I uninstall xcode 5 command line tools? I don't see anything in the release notes.

推荐答案

根据您是否在 Mavericks 中运行 Xcode 5,您需要执行两种不同的操作来卸载命令行工具.

Depending on whether you are running Xcode 5 in Mavericks or not, you will need to do two different things to uninstall the command line tools.

  • In Mavericks, Xcode includes its own copy of the Command line tools (i.e. they are bundled as part of Xcode.app). Therefore, uninstalling the Xcode (check instructions below) will remove the Command line tools too.

对于运行 Xcode 5 或更旧版本 (Xcode 4.x) 的旧 Mac OSX 版本,您可以找到以前的 SO 答案 解释了如何卸载 Xcode 的命令行工具.您可以使用此脚本(在这篇文章):

For older Mac OSX versions running Xcode 5 or older versions (Xcode 4.x), you can find previous SO answers which explain how to uninstall Xcode's command line tool. You can use this script (Read more about it in this post):

# remove_CLI_tools.sh
# written by cocoanetics:http://www.cocoanetics.com/2012/07/you-dont-need-the-xcode-command-line-tools/
# modified by yoneken

#!/bin/sh

RECEIPT_FILE1=/var/db/receipts/com.apple.pkg.DevSDK.bom
RECEIPT_PLIST1=/var/db/receipts/com.apple.pkg.DevSDK.plist
RECEIPT_FILE2=/var/db/receipts/com.apple.pkg.clang.bom
RECEIPT_PLIST2=/var/db/receipts/com.apple.pkg.clang.plist
RECEIPT_FILE3=/var/db/receipts/com.apple.pkg.llvm-gcc4.2.bom
RECEIPT_PLIST3=/var/db/receipts/com.apple.pkg.llvm-gcc4.2.plist
RECEIPT_FILE4=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.bom
RECEIPT_PLIST4=/var/db/receipts/com.apple.pkg.DeveloperToolsCLI.plist

if [ ! -f "$RECEIPT_FILE4" ]
then
  echo "Command Line Tools not installed."
  exit 1
fi

echo "Command Line Tools installed, removing ..."

# Need to be at root
cd /

# Remove files and dirs mentioned in the "Bill of Materials" (BOM)
lsbom -fls $RECEIPT_FILE1 $RECEIPT_FILE2 $RECEIPT_FILE3 $RECEIPT_FILE4 | sudo xargs -I{} rm -r "{}"

# remove the receipt
sudo rm $RECEIPT_FILE1 $RECEIPT_FILE2 $RECEIPT_FILE3 $RECEIPT_FILE4

# remove the plist
sudo rm $RECEIPT_PLIST1 $RECEIPT_PLIST2 $RECEIPT_PLIST3 $RECEIPT_PLIST4

echo "Done! Please restart XCode to have Command Line Tools appear as uninstalled."

您可以轻松运行,方法是打开终端并运行此命令(它将下载脚本并自动执行):

You can run this easily by opening a Terminal and running this command (it will download the script and execute it automatically):

curl "https://gist.github.com/yoneken/3284561/raw/db665bb64f93e38ce138b5ca620b9edd18dc31e4/remove_CLI_tools.sh" | sh

如果一切正常,您可以打开 Xcode 并看到命令行工具显示为已安装.

If everything worked fine, you could open Xcode and see that the Command Line Tools appear as to be installed.

然后,根据您的需要,例如,您可以将 Xcode 降级到较低版本并重新安装该版本的命令行工具.

Then, depending on what you want, you could downgrade Xcode to a lower version and reinstall the Command Line Tools for that version, for example.

要降级 Xcode,如this SO answer中所述:

To downgrade Xcode, as explained in this SO answer:

  1. 卸载 Xcode 5:转到 /Applications 并删除 Xcode 应用程序.
  2. 重新启动 Mac.
  3. 然后您可以从此处下载所需的 Xcode 版本并从头开始安装.
  1. Uninstall Xcode 5: go to /Applications and delete the Xcode app.
  2. Restart the Mac.
  3. Then you can download the desired Xcode version from here and install it from scratch.

这篇关于如何卸载 xcode 5 命令行工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆