Resurrect MacPorts on OS X Mountain Lion (10.8)
Installing Mountain Lion on release day came with some issues,
not that we assumed that everything would just work out of the box 😉
If you are using MacPorts, as most technicians who choose OS X to be
their operating system, you might notice that it stops working:
creo$ sudo port selfupdate 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
Well, no need to panic, help is here!
Read more after the break…
Our beloved MacPorts rely on Xcode, to be more specific on Xcode’s command line tools,
the very command line tools that are not there any more since the Mountain Lion update
deprecates your former Xcode installation.
Perform the following steps to get your MacPorts up and running again:
- Open the App Store
- Install Xcode
- Launch Xcode and go through the setup process,
you may delete your former installation to save disk space at this stage.
- Go to the Xcode Preferences
- Open the Downloads Tab
- Listed under “Components” you will find the Command Line Tools. Install them.
- You’re done!
Try to start the MacPorts selfupdate mechanism again.
You may notice the following error message:
Warning: Your developer_dir setting in macports.conf points to a non-existing directory. Since this is known to cause problems, please correct the setting or comment it and let macports auto-discover the correct path.
On my system, the setup routine of Xcode obviously tried to avoid conflicting with the
former installation by installing to the following Directory: /Developer-3.2.2
There are two methods of dealing with this:
- Create a Soft- or Hardlink from /Developer-3.2.2 -> /Developer.
This will fix the issue, but it’s more workaround than a real fix.
- Open the MacPorts configuration file at /opt/local/etc/macports/macports.conf
and change the path described as “developer_dir” to reflect your Systems Developer folder,
in my case “/Developer-3.2.2” as mentioned above.
Thinking about usability, I’d suggest the MacPorts maintainer(s) to give the user more
detailed Informations about the reason that might cause such problems.
Instead of complaining about the inability to execute a certain command,
a notice that the Xcode CommandLine Tools may be missing would have been
a quite handy hint 🙂