Mac OSX: Leopard to Snow Leopard Upgrade

Snow Leopard Installer DVD was delivered in our office on Saturday and I couldn't wait to upgrade to Snow Leopard (10.6.x). I could have upgraded earlier, if Apple had enough stores and better reseller network in India.

Anyway, upgrade was smoother  compared with Tiger(10.4.x) to Leopard (10.5.x) upgrade. Installer UI has around 4-5 steps and none of steps mention "upgrade" word. Installer is smart enough to detect existing installations, figure out which printer drivers to keep or install. However, it chooses all languages (translation) to install even when you didn't have those in Leopard.

Within fourty mintues, upgrade was completed and I was back in action.

However, In my case, I have to spend some more time to setup/fix things which were broken, such as:-

  1. Reinstalled MacPort using installer for snow-leopard and upgraded some of packages (libiconv, jpeg, libpng, libmycrypt, openssl, gettext, freetype, openssl, curl) and their dependencies for 64bit compatibilities (+universal, +variants)
  2. Compiled Apache, MySQL and PHP for 64 bit
  3. Reinstalled Remote Desktop Connection using latest installer to fix crash issue on Snow Leopard

If you don't want to use MacPorts, you can download source of these libraries separately, compile and install. These would be installed in /usr/local unless you change the prefix.

Installing 64 bit version of Apache, MySQL and PHP took around two-three hours because of some issues related to libiconv.2.dylib. Apache would compile but fail to run, reporting incorrect version of libiconv. I downloaded libiconv source, compiled and installed it in /usr/lib (instead of /usr/local/lib). Apache started working but  vim, make, other unix programs (chmod, etc) failed to run using latest libiconv.2.dylib.

I tweaked the setting in /usr/sbin/envvars to use following:-

</p>

DYLD_LIBRARY_PATH="/usr/lib:$DYLD_LIBRARY_PATH"
export DYLD_LIBRARY_PATH
export DYLD_FALLBACK_LIBRARY_PATH=/usr/local/lib:/opt/local/lib:/sw/lib

</code>

Basically, added a fallback path so if library is not found in /usr/lib, it would look into other directors, as specified.  After doing this, Apache (64bit) and vim, make, chmod, etc started working.

MySQL compilation was straight forward with following command, thanks to this link, I just added CFLAGS="-arch x86_64"  while compiling to make sure mysql is compiled for 64 bit. Moved data directory back to new mysql installation directory.

Compiling php 5.2.13 resulted into some errors related to iconv, hash and gd. After spending sometime, I decided to compile without these extensions with following commands:

</p>

MACOSX_DEPLOYMENT_TARGET=10.6
CFLAGS="-arch x86_64 -g -Os -pipe -no-cpp-precomp"
CCFLAGS="-arch x86_64 -g -Os -pipe"
CXXFLAGS="-arch x86_64 -g -Os -pipe"
LDFLAGS="-arch x86_64 -bind_at_load"
export CFLAGS CXXFLAGS LDFLAGS CCFLAGS MACOSX_DEPLOYMENT_TARGET
./configure --prefix=/usr/local/php5 --exec-prefix=/usr/local/php5 --disable-dependency-tracking --sysconfdir=/private/etc --with-apxs2=/usr/sbin/apxs --enable-cli --with-config-file-path=/etc --with-libxml-dir=/usr --with-openssl=/usr --with-kerberos=/usr --with-zlib=/usr --enable-bcmath --with-bz2=/usr --enable-calendar --with-curl=/usr --enable-exif --enable-ftp --without-gd --with-jpeg-dir=/opt/local/lib --with-png-dir=/usr/local/lib --with-freetype-dir=/usr/X11R6 --with-xpm-dir=/usr/X11R6 --with-ldap=/usr --with-ldap-sasl=/usr --enable-mbstring --enable-mbregex --with-mysql=mysqlnd --with-mysqli=/usr/local/mysql/bin/mysql_config --with-pdo-mysql=/usr/local/mysql/bin/mysql_config --with-mysql=/usr/local/mysql --with-mysql-sock=/tmp/mysql.sock --with-iodbc=/usr --enable-shmop --with-snmp=/usr --enable-soap --enable-sockets --enable-sysvmsg --enable-sysvsem --enable-sysvshm --without-xmlrpc --without-iconv --with-xsl=/usr

#if everything goes well
make

#if everything goes above, install php5 in /usr/local/php5
sudo make install

</code>

I checked (php -m) some extensions (xdebug, etc) were not loading, so I updated those individually, specially iconv, xmlrpc and gd. Compiling an extension is generally four step process. For example, if you want to compile iconv, you can do the following:

</p>

$ cd /php-source/ext/iconv
$ phpize
$ ./configure --with-iconv=/usr
$ make
$ sudo make install

</code>

It all worked fine, apache was loading php fine and all my websites and applications work fine.