如何安装 Xcode 命令行工具 [英] How to install Xcode Command Line Tools

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

问题描述

如何在当前的 Xcode/Mac OS X v10.8 (Mountain Lion) 或更高版本中安装命令行构建工具?

与 Xcode 不同的是,它没有安装程序,它只是一个捆绑包.

看起来所有的命令行工具都在包中,位于 Contents/Developer 下,但没有设置适当的环境变量来使用它们.

是否有我可以运行的脚本来设置我的环境以支持从命令行构建?

解决方案

Xcode 5.1 和 OSX 10.9.(也适用于 Xcode 5.1.1 + OSX 10.10)

xcode-select --install 使用版本 2333,使用版本 2003 失败.因此,尝试 xcode-select --install,如果不起作用,请下载为描述如下.

在 2014 年 2 月上旬,xcode-select --install 报告无法安装该软件,因为软件更新服务器当前不提供该软件".2014 年 2 月下旬,该命​​令开始仅显示帮助.解决方案是直接下载,参见下面的单独下载".

Xcode 5.0.1 和 OSX 10.9

在 Xcode 5.0.1 和 Mavericks 10.9 中,命令行工具不再可通过 Xcode 使用.相反,它们必须从 Apple 开发者工具站点下载:,然后签名使用您的 Apple ID(下载免费).在左侧窗格中,搜索命令行工具"并选择适合您的 OS X 版本的软件包.需要 Mac OS X 10.7.3 或更高版本.

How do I get the command-line build tools installed with the current Xcode/Mac OS X v10.8 (Mountain Lion) or later?

Unlike Xcode there is no installer, it's just a bundle.

It looks like all the command line tools are in the bundle, under Contents/Developer, but none of the appropriate environment variables are set to use them.

Is there a script I can run that will set-up my environment to support building from the command line?

解决方案

Xcode 5.1 and OSX 10.9. (also works with Xcode 5.1.1 + OSX 10.10)

xcode-select --install worked with version 2333, failed with version 2003. So, try xcode-select --install and if that does not work download as described below.

In early February 2014 xcode-select --install has been reporting that "Can't install the software because it is not currently available from the Software Update server". In late February 2014 the command started only displaying help. The solution is to download directly, see "Separate Download" below.

Xcode 5.0.1 and OSX 10.9

With Xcode 5.0.1 and Mavericks 10.9 the command line tool is no longer available through Xcode. Instead they must be downloaded from the Apple Developer Tools site: https://developer.apple.com/downloads/index.action. This requires signing in with a developer account.

Or via terminal (from the release docs): The Command Line Developer Tools package can be installed on demand using "xcode-select --install" and the installed tools will be automatically updated using Software Update. OS X 10.9 is required for this feature. For earlier versions, continue to use the in-app download in Xcode.

Running the command in terminal produces the following GUI:

Inside Xcode (5.0)

Xcode includes a new "Downloads" preference pane to install optional components such as command line tools, and previous iOS Simulators. To open this pane click the "Xcode" button in the top left of the screen near the Apple logo, then click "Preferences", then click "Downloads".

Xcode 5.0 screenshot:

Xcode 4.x screenshot:

Separate Download

If you do not have Xcode, they are available as a separate download from Apple:

Go to developer.apple.com/downloads/index.action, and sign in with your Apple ID (the download's free). In the pane on the left, search for "command line tools" and choose the package appropriate to your version of OS X. Requires Mac OS X 10.7.3 or later.

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

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