Categories
Uncategorized

Movabletype on MAMP

For Flycub.
It wasn't too long ago I installed <a href="http://mamp.info/"><abbr title="Macintosh, Apache, MySQL, PHP">MAMP</abbr></a> on my Macbook. Everything worked as advertised – straight out of installation. I popped <a href="http://joomla.org/">Joomla!</a>, <a href="http://expressionengine.com/">Expression Engine</a> and <a href="http://wordpress.org/">WordPress</a> in and they all ran like happy little puppies.
Installing <a href="http://movabletype.org/">MovableType</a> required me to install DBI in order to have MAMP parse Perl.
Good thing I found <a href="http://www.nargalzius.com/blog/archives/2005/09/2005_09_16_2327PM.php">Nargalzius' post</a>. His step by step instructions helped a ton. The DBI module was installed.
The DBD::MySQL module, on the other hand, was a royal pain in the behind.
For starters, Nagalzius' post was written more than a year ago and MAMP seems to have evolved quite a bit since then.There are 3 variables when you hit the <code>sudo perl MakeFile.PL</code> command.
<ul><li>mysql_config</li>
<li>cflags</li>
<li>libs</li></ul>
All of which were problems that needed to be solved.
mysql_config was no longer found in the directory Nagalzius specified. Rather than <code>/Applications/MAMP/bin/mysql4/bin/mysql_config</code>, it was located at <code>/Applications/MAMP/bin/Library/bin/mysql_config</code>.
Like <a href="http://jayallen.org/journey/2006/04/dbd-mysql-build-problems-on-mac-book-pro">Jay Allen noted</a>, the cflag path obtained from mysql_config pointed to a non-existent directory. Having absolutely no idea what it was supposed to point to, I threw every sql-esque directory at it, hoping some would stick. After hours of jostling and surfing for solutions, I realised that the cflags paramater was meant to point to a directory named "include" containing MySQL header files.
Jay Allen's observation also confirmed my initial thoughts that the message
<blockquote><code>Note (probably harmless): No library found for -lmysqlclient</code></blockquote>
I got when running the first MakeFile command wasn't really harmless. The library directory, while correct, did not have the library files necessary to install DBD::MySQL.
I downloaded <a href="http://dev.mysql.com/downloads/mysql/5.0.html">MySQL 5</a>, unpacked it and rummaged for the files I needed. I transfered the entire "include" directory into <code>/Applications/MAMP/Library/</code> and copied all the files in the <code>/lib/</code> directory into <code>/Applications/MAMP/Library/lib/mysql/</code>. I ran the make command and the make install command, and finally the <code>MT-check.cgi</code> to see if everything worked.
Sweet.
<h4>Summary</h4>
<ol><li>Find your <code>mysql_config</code>. For me, the path was <code>/Applications/MAMP/Library/bin/mysql_config</code></li>
<li><code>sudo Perl MakeFile.PL –mysql_config=/Applications/MAMP/Library/bin/mysql_config</code></li>
<li>Download <a href="http://dev.mysql.com/downloads/mysql/5.0.html">MySQL 5</a>. Unpack the files.</li>
<li>Look in the MySQL files you just downloaded and move the directory <code>include</code> to <code>/Applications/MAMP/Library/</code></li>
<li>Go to the <code>lib</code> directory in the MySQL files you just downloaded. Cut and paste all the files into <code>/Applications/MAMP/Library/lib/mysql/</code></li>
<li><code>sudo make</code></li>
<li><code>sudo make install</code</li>
<li>Run <code>mt-check.cgi</code> to see if it's all there</li></ol>
<h4>Afterword</h4>
Installing MovableType didn't work as smoothly as I thought.
Add <code>DBSocket /Applications/MAMP/tmp/mysql/mysql.sock</code> to <code>mt-config.cgi</code> to point Movabletype to the place where your <code>mysql.sock</code> is located.

Leave a Reply

Your email address will not be published. Required fields are marked *