OS X Lion Macports

OS X Lion Macports, Can I upgrade from Snow Leopard?

With the new release of Apple Mac OS X Lion, there are a lot of changes on the kernel and backends. Therefore I don’t think it’s possible to do port upgrade on Macports in order to upgrade your existing or installed ports in OS X Snow Leopard.

OS X Lion Macports

I have tried several times to upgrade ports previously installed in Snow Leopard, unfortunately no luck to getting it works in OS X Lion Macports, some library couldn’t load and some library cannot be found. Failed miserably with tons of error messages.

I have decided to re-install, or rather clean install Macports on my newly installed Mac OS X Lion.

OS X Lion Macports with XCode 4.1

Before installing OS X Lion Macports, you need to download and install latest Xcode 4.1 which designs for Mac OS X Lion. Xcode 4.1 can be downloaded at App Store, the file size is around 2.96GB, it might take some time for user who has slow internet access.

The existing Xcode on your Snow Leopard will not support latest version of Macports.

OS X Lion Macports

OS X Lion Macports, Before Clean Install

Before proceed with OS X Lion Macports clean install, I suggest you do a few things as I listed below.

1. Dump current installed packages database. Run “port installed > installed.ports.log” to keep a list of packages currently install on your Macports. Which later you will need to re-install all the packages. Below is the sample of my current installed packages.

2. Dump or backup your database data such as PostgreSQL and MySQL.

3. Backup your old directory, which is “/opt/local”, rename it to “/opt/local-snowleopard”, this is to keep all your data in order to migrate over to newly installed Macports later on.

OS X Lion Macports Clean Install

Macports team has not release latest Macports package/installer for OS X Lion (as when I written this post). If the official download is not available for OS X Lion, you need to install it from latest subversion built.

Create a new directory to check out latest subversion built for OS X Lion Macports

This will download the latest build of subversion, next we will proceed with OS X Lion Macports installation

After installation, make sure OS X Lion Macports binary is exported into your environment path, existing user should not have this problem, for new user, edit your environment path as show below; Search for export path line

Add /opt/local/bin and /opt/local/sbin into export PATH.

After environment path has been configured, get the latest update port tree and your are done

OS X Lion Macports. Install package

You are basically you done Macports installation on Mac OS X Lion. Refer to your dump file I mentioned earlier “installed.ports.log”, re-install all the packages or the packages you need in newly installed OS X Lion Macports

I know it’s a little PITA (Pain In the Ass), but so far this is the only solution which can fix my problem by migrating into OS X Lion Macports.

OS X Lion Macports. Re-install MySQL

This is an example how I reinstall and load MySQL database which previously installed on Snow Leopard Macports into OS X Lion Macports.

1. Firstly, clean install MySQL5.1 database

You might see error with plist conflict

To fix it, force plist replacement.

2. Move database into data directory, it required root privileges

3. Start MySQL Server

Please also share how you migrate existing Macports into OS X Lion Macports.