Qmail :: Part I

Introduction

You're probably here because you want to install Qmail on a Mac running OS X. That's great! The Mac platform, and OS X itself, is sufficiently different from its Linux/BSD bretheren that a few "gotchas" are lurking in the ones and zeros. This page is here to save you several hours of frustration and get Qmail up and running as quickly as possible.

Before you begin . . .

Do you have administrator priviledges on the machine?
Have you already installed the Developer Tools?
Are you comfortable working inside a terminal window?

Great! Let's get going then.

Download

Create a working directory for compiling Qmail; the name and location of this direcotry is unimportant. Download the six files (on the right) to the working directory, and unpack the Qmail source code:

# gzip -d qmail-1.03.tar.gz
# tar -xvf qmail-1.03.tar

This will create the qmail-1.03 directory containing the Qmail source code and installation files.

Setup

Qmail relies on several unpriveledged user accounts for its security and runtime operation. These accounts can be created using the niload utility. You will need to run these commands as root:

# sudo niload -d group . < group-qmail
# sudo niload -d passwd . < passwd-qmail

The new groups are assigned IDs in the range 200-201, and the new users are assigned IDs in the range 200-206. If you have any users or groups with these IDs they will be obliterated -- you have been warned.

OS X is a sufficiently different beast that some modifications to the Qmail source code are required. Applying the supplied patch to the source code will address two issues: (1) OS X uses a different linking methodolgy than most Linux/BSD systems; (2) HFS file systems are case insensitive.

Change directories to the Qmail source directory, and apply the patch file using the patch command. Rename two files that would otherwise be overwritten on an HFS filesystem (these files contain documentation on installing and configuring Qmail):

# cd qmail-1.03
# patch < ../osx-qmail.patch
# mv INSTALL INSTALL.txt
# mv SENDMAIL SENDMAIL.txt

During the build process a binary file named install is created; this file would overwrite the INSTALL document. The same is true of the SENDMAIL document; it would be overwritten by the sendmail binary.

Build

And now for the easy part. Build Qmail by typing the following command in the source directory (you should already be there if you are following directions):

# make
# sudo make setup check

Now would be a good time to consult Life With Qmail (as well as some of the other references listed in the menu) for more information on the setup and configuration of Qmail.

Post Install

In order to get Qmail to start automatically when OS X boots, you will need to create a new startup item containing the Qmail startup script and paramters list. Create a new startup directory for Qmail using the following command:

# cd ..
# sudo mkdir /Library/StartupItems/Qmail
# sudo cp Qmail /Library/StartupItems/Qmail
# sudo cp StartupParameters.plist /Library/StartupItems/Qmail

Copy the startup script (named Qmail) and the startup parameters list (named StartupParameters.plist) to the newly created directory. When you reboot your machine Qmail will automatically start.

In order to have a Maildir created automatically when a new user is added to the system you will need to modify the new user template. The new user template can be found in the /System/Library/User Template/English.lproj directory. The following four commands will walk you through the Maildir creation process:

# cd /System/Library/User\ Template/English.lproj
# sudo /var/qmail/bin/maildirmake Maildir
# sudo echo ./Maildir/ > .qmail
# sudo /Developer/Tools/SetFile -a V Maildir

The last command, SetFile -a V Maildir, will set a special bit in the Maildir meta-file such that the directory is hidden in the Finder (only works on HFS filesystems). This handy command can be used for any file/directory that you might want to hide. Originally found on the O'Reilly site macdevcenter.com -- tip #5 from the article Top Ten Mac OS X Tips for Unix Geeks.

Remember to create a Maildir for each existing user account. You will have to use the SetFile command on each Maildir individually (if you want to hide them in the Finder). After you create a Maildir for an existing user, remember to make the user the owner of the of the directory (using chown).

Contine to Part II of the Qmail installation: configuring the smtp server using tcpserver.