更新到OS X 10.9后,我的macport出现了问题。

我试着按照这个手册https://trac.macports.org/wiki/Migration来修复它们。

但是当我安装命令行工具时:

xcode-select——安装

我收到消息

无法安装该软件,因为它当前不可用 软件更新服务器。

与此同时,我成功地将我的另一台机器升级到OS X 10.9。并且安装的命令行工具没有问题,所以它们必须是可用的。

这里的问题是什么?


当前回答

有同样的问题,得到同样的错误。当我运行xcode-select -p时,输出为/Library/Developer/CommandLineTools。这意味着xcode已经安装在我的系统中了。然后我按照给出的答案运行步骤。在此之后,任何需要xcode的命令都成功运行。

其他回答

我遇到了同样的问题,无法安装软件,因为它目前不可从软件更新服务器。您可以尝试以下步骤,以使软件更新启动命令行工具的更新。

Check if Command Line Tools Update is mentioned in your list of softwares to be updated by using following command: softwareupdate -l If Command Line Tools Update is not mentioned in that list, then manually make it part of the list using following command which will create a temporary file: sudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress Verify that the list now has the Command Line Tools mentioned by running softwareupdate -l again. Now, press Cmd+Space to initiate Mac's Spotlight Search. Search for Software Update. Start the Software Update. That will show you following kind of dialog for installing the Command Line Tools. Install away the update and be merry. :) Remove the temporary file created in Step 2: sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress.

如果您使用的软件更新服务器不包含所需的包,则可能发生此错误。

你可以通过运行来检查

defaults read /Library/Preferences/com.apple.SoftwareUpdate

看看你是否有一个名为CatalogURL或AppleCatalogURL的条目

您可以通过删除此条目或使用命令指向Apple软件更新服务器

sudo softwareupdate --clear-catalog

然后再次运行命令行工具安装。

指挥+空间

搜索Xcode

打开它并接受许可

然后从终端xcode-select——install再次运行

对于OSX 10.11或更高版本,您可以从这里下载https://developer.apple.com/download/more/。

(已接受答案中的链接不显示El Capitan的命令行工具(OSX 10.11))

一旦你像Nikos M在上面的回答中描述的那样加载了命令行工具,你将需要同意gcc许可证,如果你使用ruby gems,你可能需要将llvm-gcc链接为gcc-4.2。

如果你不这样做,gem安装会在你已经安装了开发工具之后报告“你必须先安装开发工具”。

步骤如下:

sudo gcc
sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2

gcc必须在sudo下运行一次,这样Apple就可以更新他们的许可证信息,你不需要输入文件,它会在检查参数之前更新许可证。需要这个链接,以便ruby 1.9在构建某些gem(如调试器)时能够找到编译器。这可能在ruby 2中被修复。x,但船到桥头自然直。