Installation and use of Exim as an SMTP agent for Mac OS X Server
Note: This article has been superseded. Please use the material here only in an archival frame of mind, or for support for earlier versions of Exim.
Exim is a wonderful smtp agent. It lies in the strange position of being harder to configure at first than Postfix, but easier to add a number of classy options including authenticated SMTP relay and receiver verification.
To make things as easy as possible, sample config files are included in this handy compressed disk image to make life as easy as possible for you.
First of all you need to download the GNU libmcrypt library. Exim needs some help with the encryption schemes that we will be using and this library will do the trick. It compiles cleanly on Mac OS X so all you have to do is go get it at ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.4.21.tar.gz. Either use a browser, in which case StuffIt Expander will automatically unstuff it for you—or do it all from the command line:
curl -O ftp://mcrypt.hellug.gr/pub/crypto/mcrypt/libmcrypt/libmcrypt-2.4.21.tar.gz gunzip libmcrypt-2.4.21.tar.gz gnutar libmcrypt-2.4.21.tar
Then switch into the folder:
cd libmcrypt-2.4.21
and begin compilng the library:
./configure make
sudo make install
Exim actually looks for the old Unix crypt library, which libmcrypt replaces, so we need to do a little sleight of hand:
sudo ln -s /usr/local/include/mcrypt.h /usr/local/include/crypt.h
This makes the switch so that Exim is happy.
Now you need to create a user and group for Exim. Go into the Server Admin application and create a new user called “exim” with the user ID of “88” and then create a group called “exim” with a group ID of “89."
Now go download Exim:
curl -O http://www.us.exim.org/ftp/exim-3.34.tar.gz gunzip exim-3.34.tar.gzgnutar -xvf exim-3.34.tar
Then switch into the folder:
cd exim-3.34
Now take the folder called Local included with the Exim Extras and put it into the exim-3.34 folder using the Finder. This will enable authentication and all other necessary changes. If you do not have Xwindows installed, or do not want to use the Xwindows queue manager, then remove the eximon.conf file from the Local folder.
Now you are ready to get exim running.
make make install
Now just a little bit more of tidying up before you can go.
sudo touch /etc/log/exim_mainlog sudo touch /etc/log/exim_paniclog sudo touch /etc/log/exim_rejectlog sudo chown exim:exim /etc/log/exim*
This sets up thte log files for Exim and prepares them to be written to.
Now open the configure file distributed with the Exim Extras in TextEdit and do a search/replace to replace “afp548.com” with your mail domain.
Save this file on your desktop with the same name:
sudo rm /usr/exim/configure sudo mv ~/Desktop/configure /usr/exim/configure sudo chown exim:exim /usr/exim/configure
Now you need to create alias and password files for your users.
sudo touch /etc/mailaliases sudo touch /etc/relayers
In these files you can put a username with a colon and then a tab and then the alias for the mailaliases file, or for the relayers a username a colon, tab, and then the user’s password.
For example for the mailaliases:
joel: mactroll@mac.com
Or for the relayers:
joel: Xisgreat
One final bit of configuration is to move the Apple Mail Server SMTP service from port 25 to 627 by going to the SMTP tab and pulling down the first pull-down menu to “Sendmail"
Now you are ready to fire up Exim for the first time.
sudo ./usr/exim/bin/exim -bd
And Exim is up and running!
If you have any problems try looking in the /var/log/exim_paniclog if the daemon won’t start.
Or, if you are looking for more detailed info, try starting Exim with sudo ./usr/exim/bin/exim -bd -d 11.
Now to make sure Exim starts up when you reboot your machine, create the /Library/StartupItems folder if it doesn’t already exist and put the Exim folder from the Exim Extras into it.
You’re done.