Failed to get MacPort functionality after installing Xcode 4.3

I'm having issues with MacPorts functioning properly. I just installed OSX Lion 10.7.3. First I downloaded and installed MacPort, and then, after reading the requirements, I downloaded Xcode4.3 from the App Store and installed it. I launched Xcode and it looks workable and functional. However, when I tried to migrate using MacPorts, he gave me this error message (excerpt):

Warning: xcodebuild exists but failed to execute Warning: Xcode does not appear to be installed; most ports will likely fail to build. 

I followed the advice:

How to install add-on packages for Xcode on OSX Lion to enable MacPorts to work

and set command_line_tools_for_xcode from the settings in Xcode. I closed Xcode and got errors again:

 $ 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. 

I'm not sure where to go next. How can I fix the problems with the Xcode and MacPort interface?

+61
xcode osx-lion macports
Feb 17 '12 at 6:14
source share
17 answers

In theory, this should work if you have Xcode4.3 installed (in / Applications):

 $ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/ 

(And you installed the optional command line tools)

+78
Feb 23 2018-12-12T00:
source share

Everything will start working fine after installing the "Command Line Tools for Xcode" package. You can get it from here: https://developer.apple.com/downloads/index.action#

+18
Feb 23 '12 at 13:00
source share

See MacPorts port migration instructions for Xcode 4.3 .

The instructions are very attractive. You need to run xcode-select to set a new path to the tools, update developer_dir in macports.conf (as described by Henk Poley ), reinstall MacPorts (ouch), and finally uninstall and reinstall all ports (double ouch).

Edit: libpvx will still not be installed after the above. Two additional steps are required:

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

YMMV, if you have different ports installed!

+11
Feb 17 '12 at 7:01
source share

Also in /opt/local/etc/macports/macports.conf change the line with developer_dir to point to / instead of /Developer .

+10
Feb 17 '12 at 11:26
source share

After

 sudo xcode-select -switch /Applications/Xcode.app 

I also had to run

 sudo xcodebuild -license 

and accept the license

+5
Oct 29 '12 at 22:12
source share

Here is the solution that worked for me:

  • Install command-line tools for Xcode

     Xcode -> Preferences -> Downloads 
  • MacPorts Help finds the right Xcode folder

     sudo /usr/bin/xcode-select -switch /Applications/Xcode.app 
  • Create symbolic links for clang compilers as they now live elsewhere

     sudo ln -s `which clang` /Applications/Xcode.app/Contents/Developer/usr/bin/ sudo ln -s `which clang++` /Applications/Xcode.app/Contents/Developer/usr/bin/ 
+4
Feb 23 '12 at 10:18
source share

Try using a trunk, there is no Xcode 4.3 support version yet.

+2
Feb 17 '12 at 11:16
source share

Setting up the developer path in /opt/local/etc/macports.conf works for me,

 developer_dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain 

since most compilers are now stored there instead of / usr / bin under Developer.

+2
Feb 17 '12 at 12:16
source share

None of this works for me. Wait for macports to release a new version that officially supports Xcode 4.3 +

+2
Feb 23 2018-12-23T00:
source share
 sudo mv /usr/bin/xcodebuild /usr/bin/xcodebuild.old sudo ln -s /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild /usr/bin/xcodebuild 
+2
Apr 05 2018-12-12T00:
source share

Starting with Xcode 4.3, command line building tools are not installed by default. Launch Xcode, open "Settings" and go to the "Downloads" tab. From there, you should be able to install command line tools.

You can also download them from the Internet here: https://developer.apple.com/downloads/index.action

Disclaimer: I have not installed Xcode 4.3 yet. I just read about it online.

+1
Feb 17 '12 at 6:20
source share

As of 12/27/2012, the official offer from MacPorts does not seem to have to use Xcode 4.3 and instead use 4.1 to 4.2. 1, which can be downloaded from Apple.

There is a big code that can be useful for tracking the evolution of this.

By the way, and as reported in my comment No. 11 in this bug report, I am able to build ports without warning using the 2 most sensible suggestions found in this question: sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer and changing developer_dir in /opt/local/etc/macports/macports.conf to /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain

+1
Feb 27 2018-12-12T00:
source share

I have macports installed without administrator / root privileges, so I was not able to check the answers for xcode selection. However, I noticed that Pall Melstead's answer worked, but not initially. I found out that I did not accept the Xcode 4.5 license agreement !

If you just installed Xcode for macports, and you have not yet accepted the Xcode license, you may receive the error presented by the original message. When I checked the version of Xcode with /usr/bin/xcodebuild -version , I was asked to read and accept the license. After that, and after making the changes Pall proposed to macports.conf developer_dir , it all works now.

+1
Sep 25
source share

Alternatively: you can downgrade Xcode to version 4.2.1. DMG Xcode 4.2.1: https://developer.apple.com/downloads/index.action

After that, MacPorts was great for me.

0
Feb 19 '12 at 7:30
source share

This is fixed in MacPorts 2.0.4.

To update:

  • Download MacPorts 2.0.4 from the install site or run sudo port selfupdate .
  • Run the MacPorts migration described here to reinstall all ports. This is painful, but requires a return to working condition.
0
Feb 28 '12 at 21:44
source share

You should definitely run sudo xcode-select -switch /Applications/Xcode.app , as everyone here says, which will fix many problems, but certainly not all.

Afaik, all other problems exist in the configuration information for various packages. You can simply reinstall MacPorts as described in the migration guide , but I found another solution.




You should start searching for all processed port files using commands like grep /Developer/ ... , after executing sudo bash and cd /opt/local , naturally.

You must identify all processed ports using port provides ... , which I passed through sed and sort | uniq sort | uniq . You can simply reinstall all these ports using the port -n upgrade --force ... commands or the separate port uninstall ... and port install ... commands.

I recommend using the one large port -n upgrade --force ... to avoid duplication of dependency rebuilding, using subsequently separate uninstall and install commands.

There are, of course, different ports for which /Developer exists only inside text configuration files, that is, you can fix them manually with sed -i -e 's/\/Developer//g' ... but you cannot do it using binary files.

I am afraid that you should at least rebuild all your installations in Python and Perl, making this update an ideal time to clean packages that depend on older versions, ala python26 and perl5.8 .

There are several technically feasible ports that I decided not to rebuild, like fuse4x-kext , which contained /Developer inside Library/Extensions/fuse4x.kext/Contents/MacOS/fuse4x but did not prevent sshfs from working correctly.

0
Apr 04 2018-12-12T00:
source share

I originally installed xcode 3.2.2, after which I installed 4.3. When I ran xcode-select, I still got the same error as the xcode project in / Applications. Then I dug into the / usr / bin / xcodebuild script and found out that it was working correctly, and another instance of xcodebuild (the one that was installed with xcode 4.3, and not the one that was in / usr / bin) was launched:

xcodebuild: error: Directory / Applications does not contain an Xcode project.

It seems that / usr / bin / xcode -select does not work for xcode 4.3 (it compiled, so you cannot understand why it does not work). Lines do not give any clues. The good osx thing has strace .. oh wait.

In any case, the best I could do was modify /opt/local/etc/macports.conf and uncomment the line containing the xcode installation path. It seems like I'm fixing my problem for the most part.

0
Jul 01 '12 at 9:52
source share



All Articles