安装Xcode 4.3后无法获得MacPort功能

Jas*_*son 62 xcode macports osx-lion xcode4.3

我无法让MacPorts正常运行.我刚刚安装了OSX Lion 10.7.3我首先下载并安装了MacPorts,然后在阅读了要求后,我从App Store下载了Xcode4.3,然后安装了它.我推出了Xcode,它看起来是可操作的和功能性的.但是,当我尝试使用MacPorts移植时,它给了我这个错误消息(摘录):

Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
Run Code Online (Sandbox Code Playgroud)

我遵循了以下建议:

如何在OSX Lion上为Xcode安装其他软件包以允许MacPorts工作

并在Xcode中的Preferences中安装了command_line_tools_for_xcode.我关闭了Xcode,并再次得到错误:

$ sudo port install libsocketsPassword:
Warning: xcodebuild exists but failed to execute
Warning: Xcode does not appear to be installed; most ports will likely fail to build.
--->  Computing dependencies for libsockets
--->  Dependencies to be installed: openssl zlib
--->  Extracting zlib
Error: Couldn't determine your Xcode version (from '/usr/bin/xcodebuild -version').
Error: 
Error: If you have not installed Xcode, install it now; see:
Error: http://guide.macports.org/chunked/installing.xcode.html
Error: 
Error: Target org.macports.extract returned: unable to find Xcode
Error: Failed to install zlib
Log for zlib is at: /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_archivers_zlib/zlib/main.log
Error: The following dependencies were not installed: openssl zlib
Error: Status 1 encountered during processing.
Run Code Online (Sandbox Code Playgroud)

我不确定下一步该怎么做.如何解决我的Xcode和MacPort界面问题?

geo*_*war 84

理论上,如果您安装了Xcode4.3(在/ Applications中),这应该可以工作:

$ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/
Run Code Online (Sandbox Code Playgroud)

(并且您已经安装了可选的命令行工具)


小智 18

安装"Xcode命令行工具"软件包后,一切都会正常工作.你可以从这里得到它:https://developer.apple.com/downloads/index.action#


gmc*_*ton 11

请参阅Xcode 4.3MacPorts迁移说明.

说明非常复杂.您需要运行xcode-select设置一个新的工具路径,更新developer_dirmacports.conf(如由亨克Poley),重新安装的MacPorts(哎哟),最后卸载并重新安装所有端口(双哎哟).

编辑: libpvx上面之后仍然不会安装.需要两个额外的步骤:

  1. sudo ln -s /Developer /
  2. sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs /SDKs

YMMV如果您安装了不同的端口!

  • 我只能通过将两个软链接添加到我的根目录(编辑中提到的Developer和SDK)来实现此功能.无需迁移macports. (2认同)
  • 这些说明比所需要的更复杂.我只是确保`xcode-select`指向正确的路径,并且/opt/local/etc/macports.conf有`developer_dir/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain`. (2认同)

Hen*_*ley 10

也在/opt/local/etc/macports/macports.conf改变developer_dir指向/而不是指向的行/Developer.


Gre*_*len 5

sudo xcode-select -switch /Applications/Xcode.app
Run Code Online (Sandbox Code Playgroud)

我也不得不跑

sudo xcodebuild -license
Run Code Online (Sandbox Code Playgroud)

并接受许可