MovableType with MAMP (OS X)

NOTICE
CONTENTS OUTDATED

The MAMP+MT implementation process today differs drastically from the time this tutorial was first posted. I suggest checking the comments for a link of a possible updated tutorial from another user.

I tried installing MovableType locally in my laptops webserver (OSX), but ran into some snags. It turns out that there are non built-in perl modules required for it to access the MySQL database. What made it worse is that I was running MAMP and not the normal Apache webserver bundled with the OS.

I figured I’d write this for those users planning to do the same thing… and of course the ever persistent reason of “for my future reference.”mamp: http://www.mamp.info/en/home/ “Visit site”

First a couple of preliminary facts: the MySQL is not activated by default… it isn’t even configured. Unlike Apache, which can be launched via System Preferences, the MySQL server has to be started via Terminal (well, at least, that’s what I had to do).

MAMP 1 Macintosh, Apache, MySQL, PHP solves that problem because it was meant to be self-contained by design. Meaning every component you would usually have for dynamic publishing, is already included and pre-configured. Unfortunately, this is a very broad area to cover, so MAMP only deals with the most common stuff people need, and can’t really be expected to have any other special modules installed by default.

Before everything else, now is a good time to install the Developer Tools included in your OSX CD, you need this to compile and install the Perl modules you’ll need for MT-MySQL access.

It is to be noted that Perl support isn’t enabled by default in MAMP so make sure to configure your httpdconf file to enable it. Just uncomment the line (take out the #) where it says:

AddHandler cgi-script .cgi

Once you’ve done that, visit this URL http://www.cpan.org/modules/by-category/07_Database_Interfaces/DBD/

Download these latest (or not) versions of these two files (where x are numbers):

  • DBI Module (filename is DBI-X.XX.tar.gz)
  • DBD::MySQL module (filename is DBD-mysql-X.XXXX.tar.gz)

Extract both of these files in /Library/Perl

To install the DBI module, do this (again x is a number):

cd /Library/Perl/DBI-X.XX

sudo Perl Makefile.PL sudo make sudo make install

To install the DBD::MySQL module, it’s pretty much the same with one nuance.

cd /Library/Perl/DBD-mysql-X.XXXX

sudo Perl Makefile.PL –mysql_config=/Applications/MAMP/bin/mysql4/bin/mysql_config sudo make sudo make install

Notice the extra parameters in one line – this is precisely because we are on a MAMP environment, and you have to explicitly point it there, else it wont compile properly. Of course the actual path of --mysql_config= would depend where you put your MAMP folder.

Once both have been installed, you can delete the folders where you extracted them to. Because the installed modules should now be located in a folder resembling /Library/Perl/X.X.X/darwin-thread-multi-2level (at least that’s where it put mine)

That’s it! You’re now ready to use MovableType locally on your machine with MySQL support 😉

Notes

Notes
1 Macintosh, Apache, MySQL, PHP

7 Replies to “MovableType with MAMP (OS X)”

  1. Hello. Thanx for nice tut but id didn’t work for me….. Are you sure about the DBD::MySQL module and this code?:

    cd /Library/Perl/DBI-X.XX

    sudo Perl Makefile.PL –mysql_config=/Applications/MAMP/bin/mysql4/bin/mysql_config sudo make sudo make install

    I have an error which says: “Can’t locate DBI/DBD.pm in @INC” 🙁 Any help?

  2. Oooooh, sorry I noticed that I made a mistake in the Tut, notice the line cd /Library/Perl/DBI-X.XX is for the DBI module (I forgot to edit it to reflect the DBD::MySQL module). Basically you have to navigate to the said module you’re trying to compile (where you extracted DBD::MySQL).

    The reason it won’t compile is because it’s trying to recompile the DBI module, when it should be the DBD::MySQL 😉

    I’ll edit the post, sorry for the inconvenience and hope the corrections work for you.

  3. Hello and thanks a lot for sharing your experience. I’m trying to put together the same set-up on my MacBook but I’m having trouble with DBD:mysql.

    I’ve followed your instructions — it worked fine with DBI, but DBD::mysql install doesn’t go thru.

    sudo Perl Makefile.PL –mysql_config=/Applications/MAMP/bin/mysql4/bin/mysql_config

    specified mysql configuration script ‘/Applications/MAMP/bin/mysql4/bin/mysql_config’ doesn’t exist.
    Please check path/permissions. Will try to use default mysql_config
    script found through PATH.
    Can’t exec “mysql_config”: No such file or directory at Makefile.PL line 454.

    Any idea on what I did wrong ? Thanks again.

  4. Flycub,

    I just installed XCode tools (and all other developers included on the installer) on my MacBook Pro (the tutorial was made during my Powerbook days) and tried everything out. Doing the exact same process seems to be working. I couldn’t replicate your problem, so I can’t really suggest anything that will solve it.

    But the error suggests a mismatch in the PATH of the said file. The only thing I can think of is that you probably have MAMP in a directory OTHER than /Applications (/Users/<USERNAME>/Applications perhaps?)

  5. I found my mysql_config file in /Applications/MAMP/Library/bin. Ran the Perl Makefile…seemed like it worked. But somehow make gives me a ton of errors.

  6. The current version of MAMP (MAMP 1.4.1) dows not have the mysql_config file where you’re tutorial says. I tried to change the line to:

    sudo Perl Makefile.PL –mysql_config=/Applications/MAMP/Library/bin/mysql_config

    But it failed with the DBD-mysql-4.00 I downloaded from CPAN.

    Any ideas?

    Reed

Have a say

This site uses Akismet to reduce spam. Learn how your comment data is processed.