Installing MacPorts and MySQL on Leopard
I recently had to re-install a development environment on a Mac Pro so I kept track of the steps as I went. Here’s the simplest way to get MacPorts and MySQL installed on Leopard.
Install XCode 3.0 from Leopard Install Disk 2 Download MacPorts installer from http://www.macports.org/install.php and run. Then, add the following to ~/.bash_profile (and then restart your Terminal):
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH
export ARCHFLAGS="-arch i386"
bind 'set completion-ignore-case on'
That last line is not strictly needed but I like to be able to tab through directory names without caring about the capitalisation. Finally run:
$ sudo port -v selfupdate
OK, that’s MacPorts out of the way, on to MySQL:
$ sudo port install mysql5 +server
$ sudo -u mysql mysql_install_db5
$ cd /opt/local
$ sudo /opt/local/lib/mysql5/bin/mysqld_safe
Add the following as /opt/local/etc/mysql5/my.cnf:
[mysqld_safe]
socket=/tmp/mysql.sock
Lastly, try it out (and set it to start on reboot) with:
$ sudo /opt/local/lib/mysql5/bin/mysqld_safe
$ sudo launchctl load -w /Library/LaunchDaemons/org.macports.mysql5.plist
$ sudo ln -s /tmp/mysql.sock /opt/local/var/run/mysql5/mysqld.sock
If I’ve missed anything, let me know.