如何在 Yosemite 上安装 Xcode 和命令行工具?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/29483364/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 06:55:44  来源:igfitidea点击:

How do you install Xcode and the Command Line Tools on Yosemite?

xcodeosx-yosemite

提问by 7stud

I followed the instructions here:

我按照这里的说明操作:

http://quantgreeks.com/how-to-install-xcode-command-line-tools-in-osx-yosemite/

http://quantgreeks.com/how-to-install-xcode-command-line-tools-in-osx-yosemite/

However, I didn't fit the exact requirements for that tutorial because I never installed Xcode before. In addition, I had trouble figuring out how to download Xcode. I ended up at the App Store, where it said my Developer account had been suspended for security reasons--but I can log in fine in the Apple Developer area. I ended up here:

但是,我不符合该教程的确切要求,因为我之前从未安装过 Xcode。此外,我在弄清楚如何下载 Xcode 时遇到了麻烦。我最终去了 App Store,那里说我的开发者帐户因安全原因被暂停——但我可以在 Apple 开发者区正常登录。我结束了这里:

https://developer.apple.com/devcenter/mac/index.action

https://developer.apple.com/devcenter/mac/index.action

where I clicked on View all downloads, and then I downloaded the Xcode 6.2 dmg file. Then I clicked on the dmg file, and the installer had me drag the Xcode icon onto a folder icon.

我点击查看所有下载,然后我下载了 Xcode 6.2 dmg 文件。然后我点击 dmg 文件,安装程序让我将 Xcode 图标拖到文件夹图标上。

I followed the rest of the steps in the tutorial, and at the end of the tutorial, it says to test your install like this:

我按照教程中的其余步骤进行操作,在教程结束时,它说要像这样测试您的安装:

$ xcode-select -p
/Library/Developer/CommandLineTools

However, I get the output:

但是,我得到了输出:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

I do have the following directory:

我确实有以下目录:

/Library/Developer/CommandLineTools

My conclusions:

我的结论:

1) In tutorials, make sure you pay attention to the distinction between the phrases the Full Xcode Packageand the the Xcode Command Line Tools.

1) 在教程中,请确保注意短语the Full Xcode Packagethe Xcode Command Line Tools.

2) If you install the Full Xcode Package, and then you test the installation I think this might be the correct output:

2) 如果您安装Full Xcode Package, 然后您测试安装我认为这可能是正确的输出:

$ xcode-select -p
/Applications/Xcode.app/Contents/Developer

3) If you install just the Xcode Command Line Tools, and then you test the installation, then this might be the correct output:

3) 如果您只Xcode Command Line Tools安装 ,然后测试安装,那么这可能是正确的输出:

$ xcode-select -p
/Library/Developer/CommandLineTools

回答by Mikelax

I follow this linkto detect and install the Xcode command line tools.

我按照这个链接来检测和安装 Xcode 命令行工具。

Here is the main command it sounds like you need to follow after verifying the full Xcode package is installed.

这是在验证安装了完整的 Xcode 包后您需要遵循的主要命令。

xcode-select --install

回答by Bachiri Taoufiq Abderrahman

I follow this linkto install the Xcode command line tools.

我按照此链接安装 Xcode 命令行工具。

You can choose your command line tools depending on your OS X for example for me I have OS X 10.8.5 I go to command_line_tools_for_osx_mountain_lion_april_2014

您可以根据您的 OS X 选择命令行工具,例如我我有 OS X 10.8.5 我去 command_line_tools_for_osx_mountain_lion_april_2014