This guide will take you through the steps to install the necessary software to turn your Mac into a server with the required software to run Movable Type and then walk you though installing Movable Type.
You will need the following:
- A Mac! - this installation was tested on a Mac Mini, an iMac, and a MacBook Pro both running Mac OS 10.5.5
- Administrator user account on the Mac
- Xcode Tools instaler on the Mac OS X Install DVD or available as a download from Apple.com
- internet connection …well I guess you have one if you’re reading this!
- Terminal.app - find this in your Utilities folder (from the Finder: Go > Utilities). You should be comfortable using the command line when proceeding with the following steps.
We’ll first install the following server software:
- Xcode Tools
- MySQL
- PHP5
- Perl modules:
- DBD::mysql
- Crypt::DSA
- IPC::Run
- Crypt::SSLeay
- IO::Uncompress::Gunzip
- IO::Compress::Gzip
- Mail::Sendmail
- Image Magick and required image libraries:
- LibJPEG
- Libpng
- Libiff
Then we’ll perform the steps specific to setting up a site and installing Movable Type:
- create a file structure for a site
- create a default apache config
- download Movable Type
- create a MySQL database
- configure Movable Type
Install Server Software
Installing these 8 software libraries takes about 45 minutes. As I completed the step, I noted the running time.
Install Xcode Tools
Double-click “XcodeTools” from the DVD that came with your mac.
Find it on the DVD in the following folder chain: Mac OS X Install DVD/ Optional Installs/ Xcode Tools/ XcodeTools
(running time: 8 min)
Install MySQL
- Go here: http://dev.mysql.com/downloads/mysql/5.1.html#macosx-dmg
Download Mac OS X 10.5 (x86)
Note: After choosing a mirror, you are prompted to register. No need, click the link under the registration and sign in boxes: “No thanks, just take me to the downloads!”
Install (double-click) all the following items in the bundle:
- mysql-5.1.34-osx10.5-x86.pkg (or newer version)
- MySQLStartupItem.pkg
- MySQL.prefPane
After installing MySQL.prefPane, the preference pane will be displayed. Click the Start MySQL Server button and be sure the checkbox for Automatically Start MySQL Server on Startup is checked.
(running time: 12 min)
Install PHP
PHP 5.x is pre-installed in Mac OS 10.5.x. Edit the apache config:
$ sudo vi /private/etc/apache2/httpd.conf
Remove the “#” from the beginning of this line to enable PHP:
#LoadModule php5_module libexec/apache2/libphp5.so
(running time: 14 min)
Install Perl modules
Install the below modules via Terminal app. Each may take a few minutes to install. If installation seems to stall but you get no errors, then assume all is going well. If necessary, go make a sandwich and come back a little while later.
While installing, if prompted:
- enter the admin user password when prompted: type the password and hit “return”.
- manual configuration: type “n” and hit “return” to use default configuration.
- optional modules: type “n” and hit “return” to not install these.
- mandatory modules: type “y” and hit “return” to install these.
- select the default option when otherwise prompted: hit “return”.
Install be below Perl modules one-by-one (running time listed below):
$ sudo cpan DBD::mysql $ sudo cpan IPC::Run $ sudo cpan Crypt::SSLeay $ sudo cpan IO::Uncompress::Gunzip $ sudo cpan IO::Compress::Gzip $ sudo cpan Mail::Sendmail $ sudo cpan Crypt::DSA
sudo cpan DBD::mysql (running time: 15 min)
sudo cpan IPC::Run (running time: 16 min)
sudo cpan Crypt::SSLeay (running time: 17 min)
sudo cpan IO::Uncompress::Gunzip (running time: 18 min)
sudo cpan IO::Compress::Gzip (running time: 19 min)
sudo cpan Mail::Sendmail (running time: 20 min)
sudo cpan Crypt::DSA (running time: 22 min)We’ll check to ensure all these modules are installed correctly using the mt-check.cgi script after installing Movable Type.
Install ImageMagick
We’ll install three image libraries and then ImageMagic itself.
Create a temp directory
This directory will be used for the downloaded software used in the following steps. Create it then change to that directory:
$ mkdir ~/Desktop/mt_install; $ cd ~/Desktop/mt_install;
Install image libraries
There are three prerequisite libraries for the version of ImageMagick we’ll be installing.
The below steps assume that you’re downloading files to the “Downloads” in the user’s home directory; modify the installation commands as necessary if your browser downloads the files to other locations.
Install LibJPEG
- Download LibJPEG. Grab the most recent
tar.gz
file from www.ijg.org Issue the following commands (replacing the name of the
tar.gz
below with file name below “jpegsrc.v6b.tar.gz
”):$ cd ~/Desktop/mt_install; $ mv ~/Downloads/jpegsrc.v6b.tar.gz .; $ tar xfv jpegsrc.v6b.tar.gz; $ cd jpeg-6b; $ ln -s `which glibtool` ./libtool $ MACOSX_DEPLOYMENT_TARGET=10.5; $ export MACOSX_DEPLOYMENT_TARGET; $ ./configure --enable-shared; $ make; $ sudo mkdir /usr/local/include /usr/local/lib /usr/local/bin /usr/local/man /usr/local/man/man1; $ sudo make install;
(running time: 25 min)
- Download LibJPEG. Grab the most recent
Install libpng
- Go the the libpng site: http://www.libpng.org/pub/png/libpng.html.
- Scroll to the “Source code” section and click the “.tar.gz” link under “with config script” heading.
Issue the following commands:
$ cd ~/Desktop/mt_install; $ mv ~/Downloads/libpng-1.2.35.tar.gz .; $ tar xfv libpng-1.2.35.tar.gz $ cd libpng-1.2.35; $ ./configure --enable-shared; $ make; $ sudo make install;
(running time: 29 min)
Install libtiff
- Download
tiff-3.8.2.tar.gz
from http://dl.maptools.org/dl/libtiff/ (which is the download mirror site of http://www.libtiff.org/) Issue the following commands:
$ cd ~/Desktop/mt_install; $ mv ~/Downloads/tiff-3.8.2.tar.gz .; $ tar xfv tiff-3.8.2.tar.gz; $ cd tiff-3.8.2; $ ./configure --enable-shared; $ make; $ sudo make install;
(running time: 32 min)
- Download
install ImageMagick
Download ImageMagic via FTP
$ cd ~/Desktop/mt_install; $ ftp ftp://ftp.imagemagick.org/pub/ImageMagick/ImageMagick.tar.gz $ tar xfvz ImageMagick.tar.gz;
List the contents of the current directory to find the version of ImageMagick which was downloaded:
$ ls
Change to the ImageMagick directory. If you downloaded
ImageMagick-6.5.2-2
, then continue with the steps below, otherwise the next line to contain the correct version number. (Note: the “make” command takes about 5-8 min to complete)$ cd ImageMagick-6.5.2-2; $ LDFLAGS="-L/usr/local/lib" ./configure --with-jpeg=/usr/local/ --with-tiff=/usr/local --with-png=/usr/local; $ make; $ sudo make install;
(running time: 43 min)
Movable Type Specific Install
Create the file structure for local website
This command will set up the basic structure of the
_live
directory in the~/Sites
directory as described below:$ mkdir ~/Sites/_live ~/Sites/_live/cgi ~/Sites/_live/docs ~/Sites/_live/html;
The below file structure is how I setup the sites I develop locally on my Mac. I’m never actively developing one site at a time so I have a single webroot which I move the active site into; site1.com is the currently active site. (I have a script that I use to switch sites in and out of the web root which I may post about at a later date.)
~/Sites/ _live/ cgi/ mt <-- symlink to current MT directory (created in a later step) MT-4.25-en/ <-- MT app directory, aka $MT_HOME (created in a later step) docs/ httpd.conf <-- custom apache config (created in a later step) html/ <-- this will be the web-root mt-static/ <-- symlink to dir in $MT_HOME (created in a later step) index.html site1.com/ <-- random site (currently disabled) docs/ httpd.conf html/ index.html site1.com/ <-- site currently active in the _live directory site2.com/ <-- random site (currently disabled) docs/ httpd.conf html/ index.html
Configure the Apache web server
Create the user apache configuration file (
~/etc/httpd/httpd.conf
) and directories:$ mkdir ~/etc/ ~/etc/httpd/; $ vi ~/etc/httpd/httpd.conf;
Use the following code as the contents of the file, replacing “beau” and “sweetness” (name of my computer) with your own variables. (Set your computer’s name on the System Preferences -> Sharing Pane)
<VirtualHost *:80> ServerName sweetness.local ServerAlias *.sweetness.local ServerAlias localhost DocumentRoot /Users/beau/Sites/_live/html DirectoryIndex index.php index.html # Include custom apache configuration from live site directory. include /Users/beau/Sites/_live/docs/*httpd.conf <Directory /Users/beau/Sites/_live> Order allow,deny Allow from all AllowOverride All Options Indexes FollowSymLinks MultiViews AddHandler application/x-httpd-php .php .html </Directory> </VirtualHost>
Not all of this config file is crucial, but it’s all useful!
Alias the user apache config file into the directory which the main apache config includes other config files.
In the Terminal app create a symlink using the following command (replace “beau” with your username)
$ sudo ln -s ~/etc/httpd/httpd.conf /private/etc/apache2/other/beau.conf
The main apache config file (located here:
/private/etc/apache2/httpd.conf
) contains the lineInclude /private/etc/apache2/other/*.conf
which will include all file ending in “.conf” which are placed in the/private/etc/apache2/other/
directory.Create site apache config file
Create the file:
$ vi ~/Sites/_live/docs/httpd.conf
Add the following content:
ScriptAlias /cgi/ /Users/beau/Sites/_live/cgi/ Alias /mt-static/ /Users/beau/Sites/_live/cgi/mt/mt-static/ AllowEncodedSlashes On # required for MTConnect plugin <Directory "/Users/beau/Sites/_live/cgi"> AllowOverride All Options None Order allow,deny Allow from all Options FollowSymLinks </Directory> <Directory "/Users/beau/Sites/_live/html"> AllowOverride All Options +Indexes Order allow,deny Allow from all Options FollowSymLinks </Directory> SetEnv MAGICK_HOME /usr/local/ImageMagick-6.4.0 SetEnv DYLD_LIBRARY_PATH /usr/local/ImageMagick-6.4.0/lib
Restart Apache
$ sudo apachectl graceful
This is the same as unchecking and then checking the “Web Sharing” checkbox in the System Preferences -> Sharing preference pane
Download Movable Type
Filenames may be different if using different version of Movable Type.
Download
Uncompress the downloaded file
$ unzip ~/Downloads/MT-4.25-en.zip
Move MT to the live directory’s cgi folder
$ mv ~/Downloads/MT-4.25-en ~/Sites/_live/cgi/
Create symlink aliasing
mt
to the current version of MT.$ ln -s ~/Sites/_live/cgi/MT-4.25-en ~/Sites/_live/cgi/mt
Note: This step will ease future upgrades. When upgrading in the future, use a modified version of this code to remove the symlink then replace it with a symlink to the new version:
$ rm ~/Sites/_live/cgi/mt; ln -s ~/Sites/_live/cgi/NEW_MT_VERSION ~/Sites/_live/cgi/mt
Create MySQL database
Login to MySQL via the Terminal.app
$ sudo /usr/local/mysql/bin/mysql
Optional: Instead of entering the full path to MySQL
/usr/local/mysql/bin/mysql
, you can add the mysql location to your PATH. After doing the following you can simply entersudo mysql
. After updating.bash_profile
you will need to open a new terminal window to reload bash profile settings. Minimally,.bash_profile
should contain the following:PATH=$PATH:/usr/local/mysql/bin/ export PATH
Create database for Movable Type
mysql> create database movabletype;
Note: Instead of using
movabletype
you may want to create one database per version of Movable Type or per project/site.Set permissions on the database.
mysql> grant all on movabletype.* to ''@'localhost' identified by '';
Note: this command uses no username or password. This can make installation simper on a local machine, however it is recommended that a password be used on any shared machine.
Configure Movable Type
Create MT config file
~/Sites/_live/cgi/mt/mt-config.cgi
and include the necessary variables. At a minimum this file should include:CGIPath /cgi/mt/ StaticWebPath /mt-static ##### MYSQL ##### ObjectDriver DBI::mysql Database movabletype # DBUser DATABASE_USERNAME # unnecessary unless a username was set in the previous step # DBPassword DATABASE_PASSWORD # unnecessary unless a password was set in the previous step DBHost localhost
Access Movable Type “MT Check” script
http://localhost/cgi/mt/mt-check.cgi (or http://sweetness.local/cgi/mt/mt-check.cgi)
Note: Everything on this check list should be green except for the non-MySQL database drivers and GD (Image Magic is better integrated with Movable Type than GD is.)
If
mt-check.cgi
shows that various modules are not installed, attempt to re-install using the steps above.Install Movable Type
Access this URL and follow the steps to create your first blog.
http://localhost/cgi/mt/mt.cgi (or http://sweetness.local/cgi/mt/mt.cgi)
Blog!
Awesome work Beau, thanks!
Out of curiosity, why not use macports for some of these components?
AFAIK, by installing MacPorts you lock yourself into using MacPorts for any other command line software that you want to use—if no MacPort exists for something you want to use, you’re stuck—therefore my goal was to install all necessary software natively.
Great tutorial! I had some problems creating .bash_profile but creating a new one solved my problems. MT4.32 is successfully installed on my Mac.
Thanks for this excellent writeup. I particularly like that you explain how to install from source as opposed to Macports which I’ve had nothing but bad experiences with.
I just wish I had come across this post earlier, as I struggled mightily (if successfully) to install ImageMagick on my own servers.
Good stuff! However, I’m running into an issue when trying to install LibJPEG. I’m running snow leopard - 10.6.2.
Instead of $ MACOSX_DEPLOYMENT_TARGET=10.5; I entered this:
Tried to run make, and got this error message:
Any idea how I can fix this problem?
Thanks!
This is a glitch in the libjpeg builder I think. Is this libjpeg6b that you’re trying to compile? They may have fixed this in libjpeg7 http://www.ijg.org/files/jpegsrc.v7.tar.gz
I don’t have a copy of v6b sitting around, but I tried v7 on my snowlepoard machine and it seems to be just fine.
Let me know if it still doesn’t work for you with v7.
Thanks hachi, I’ve updated the content to reference v7 of libjpeg.
Thanks for the instructions Beau. I’ve gone through the entire process of the install on Mac OS X 10.6.2
Most all seems well except for the following:
Under mt-check.cgiCrypt::DSA Your server does not have Crypt::DSA installed, or Crypt::DSA requires another module that is not installed. This module accelerates comment registration sign-ins. Please consult the installation instructions for help in installing Crypt::DSA.
GD Your server does not have GD installed, or GD requires another module that is not installed. This module is needed if you would like to be able to create thumbnails of uploaded images. Please consult the installation instructions for help in installing GD
For mt.cgiWhen I access http://localhost/cgi/mt/mt.cgi, I get an Internal Server error. I find this strange given the fact that I was able to access and view http://localhost/cgi/mt/mt-check.cgi
Your feedback would be appreciated. Thanks!
Sorry, I don’t really have the ability to troubleshoot this with you… but suggestion would be to take a look in your http/apache logs for more detailed errors. Also check the permissions of the *.cgi files.
Excellent tutorial Beau, thank you very much!
Cannot wait to put it at work as I’m planning to switch over to a Mac.
Very usefull information, thanks
Beau, thank you very much.
I could make MT work at Snow Leopard following your tutorial (most of it :D).
Thank you so much!
Thank you again for this article, I really think this is one of the best of this blog now!
This is entirely above my head. And here I thought a Mac was for simple people. I can honestly say that being a standard Windows user, I know next to nothing of what a Mac can, and cannot do.