Recently I upgraded one of my Macs to Mountain Lion and subsequently need to upgrade the installation of MacPorts. I hope that writing this will help some future self avoid the pain points I did experienced during this process. While it may seem logical upon reading it was a lot of trial and error (mostly error) to reach this point.
Initially as a shot in the dark I attempted to run a self update. While it may seem like small change to upgrade to 2.2.0 from 2.1.2 unfortunately, there were issues. As promising as the update started after a few minutes the results ended up in failure as demonstrated by the following output:
> sudo port selfupdate ---> Updating MacPorts base sources using rsync MacPorts base version 2.1.2 installed, MacPorts base version 2.2.0 downloaded. ---> Updating the ports tree ---> MacPorts base is outdated, installing new version 2.2.0 Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl Error: /opt/local/bin/port: port selfupdate failed: Error installing new MacPorts base: command execution failed
At this point I resorted to using the latest packaged installer for Mountain Lion and one that was completed I reran the self update just to reassure myself that things were right.
> sudo port selfupdate ---> Updating MacPorts base sources using rsync MacPorts base version 2.2.0 installed, MacPorts base version 2.2.0 downloaded. ---> Updating the ports tree ---> MacPorts base is already the latest version The ports tree has been updated. To upgrade your installed ports, you should run port upgrade outdated
Being the adventurous tech guy that I am I ran the upgrade outdated command as directed. I figured what’s the worst that could happen right? Unfortunately for me as you’ll note form the output this command failed. I was lucky in that it did fail early. nothing is more frustrating than building a large project from source only to have it explode during the last stage of package registration. Another positive was that the error was pretty explicit, identifying the source of the problem which was an incompatibility between well the source and the compiler.
> sudo port upgrade outdated ---> Fetching archive for adns ---> Attempting to fetch adns-1.4_0.darwin_12.x86_64.tbz2 from http://packages.macports.org/adns ---> Attempting to fetch adns-1.4_0.darwin_12.x86_64.tbz2.rmd160 from http://packages.macports.org/adns Error: The installed version of Xcode (2.0orlower) is too old to use on the installed OS version. Version 4.6.2 or later is recommended on Mac OS X 10.8. Error: Unable to upgrade port: 1 To report a bug, follow the instructions in the guide: http://guide.macports.org/#project.tickets
Upgrading Xcode is no longer a simple download (weighing in at a hefty 1.65GB) in that you must use the AppStore in order to attain access to the binaries. This will frustrate anyone who has a large installation of Macs that need to install Xcode on but that is a discussion for another time. In this case I let the automated app store magick happen. Once Xcode is properly installed you will need to install the optional command line (cli) tools.
Launch Xcode accepting all of the licensing then open the preferences pain as demonstrated above. Highlight the cli tools and click the install button on the right. Once they have been installed the blue progress bar will changed to ‘Installed.’
You are now safe to run the upgrade outdated command letting your system clean itself up. Honestly that all there is to it but not quite. One last thing we need to discuss is the AppStore requirement in order to access Xcode. It is a bit of a lie in that you can download the packages directly if you have an Apple Developer account. Pre-downloading the large binaries and storing them on removable media or even a central server can greatly enhance company wide distribution.
The following snapshots display the current Xcode and Command Line Tools developer notes from the Apple Developer Site:
If you do not have a developer account with Apple then obviously you will have to apply for one. I have had one for several years and honestly do not have any idea what new hoops they make you jump through to register. I’ve always found it handy to have one so I can’t recommend it enough.
Well there you have it. Feel free to leave thoughts or suggestions in the comment thread?
Leave a Reply