SpamAssassin and OS X

Well, I’ve been working on getting SpamAssassin working with Mac OS X, and have gotten it working pretty good. Either just to filter spam for the computer, or for an entire network.

Note: This to the best of my knowledge works correctly… But this is at your own risk. I have only tested this one one system. If there is a problem, removing the SAProxy directory from the StartupItems should resolve any issues. If it locks on startup, boot off of another disk (I perfer a Mac OS 9 CD), then remove that directory.. It will disable SpamAssassin, but allow you startup and use your computer as it was before.

The first thing to do is install SpamAssassin. Here is what needs to be done.

This guide assumes you have Developer Tools already install (that grey CD that came with Mac OS X). You can download it at:

First we need to install a few modules.

These modules are required for spamassassin to build:

  • ExtUtils::MakeMaker >= 5.45 (from CPAN, or included in Perl 5.6 and higher)
  • File::Spec >= 0.8 (from CPAN, or included in Perl 5.6 and higher)
  • Pod::Usage (from CPAN, or included in Perl 5.6 and higher)
  • HTML::Parser >= 3.0 (from CPAN)
  • Sys::Syslog (from CPAN)

Ben Trott’s article will show you how to install those quickly. Do only step 2, and only for the modules above. Ignore him for the rest, he is installing it a bit differently.

Now we need the latest SpamAssassin distribution. It can be found on the downloads page. Copy the URL of the latest version to the clipboard. Then open terminal and enter the following (note the URL syntax may be slightly different depending on the version. This is for 2.53):

curl -O

The next step is to expand this download (again note the file name might be slightly different:

gnutar xzf SpamAssassin-2.53.tar.gz

Then CD to the directory (once again, the directory name may be slightly different, check that version number) and run the makefile script:

CD SpamAssassin-2.53perl

This should be somewhat quick, a minute or two.


This will take a bit longer. Don’t worry about all the garbage on the screen. That’s because the authors love the matrix 😉 As long as there are no errors, your looking good.

sudo make install

You will need to enter your password, do so… then in a minute or so it will be complete.

That was the worst part…Not bad eh? You can now delete the SpamAssassin-x.xx directory, and the compressed archive you downloaded earlier… They are no longer needed.

Now to create the proxy.

Again, in terminal
Create a directory on the root of your hard drive, name it “saproxy”. Then open it:

CD /
mkdir saproxy
CD saproxy

Now we need to install the proxy script.


Now in your web browser, copy and paste the contents of this page into the terminal window

Control “O” to save the file, say yes to changes.
Control “X” to quit pico

Once again for the kill script:


And the source for this file can be found here:
Paste it in, save the file, and exit pico

Now we get to decide how to run it.

Create a directory named “SAProxy” in the StartupItems folder:

CD /Library/StartupItems
mkdir SAProxy
CD SAProxy

Now create a file named SAProxy

sudo pico SAProxy

Paste the following into it:

# *********************************************************************
# ** /Library/StartupItems/SAProxy/SAProxy **
# *********************************************************************
# ** **
# ** This is the intialization script for SAProxy services on Mac OS **
# ** X. The permissions of this file need to be set to 0755. This **
# ** can be accomplished from the Terminal while in this directory **
# ** by typing: chmod 0755 Samba This will adjust the properties so **
# ** that it can be executed. **
# ** **
# ** To configure SAProxy to launch: as root, edit the file **
# ** /etc/hostconfig at the very end enter: **
# ** SAPROXY=-YES- You can easily change this entry to enable **
# ** or disable SAProxy whenever you like. **
# ** **
# ** **
# *********************************************************************
# Robert J. Accettura
# @ April 13, 2003

# ---------------------------------------------------------------------
# Include system wide configuration options
# ---------------------------------------------------------------------
. /etc/rc.common

# ---------------------------------------------------------------------
# Start SAProxy services
# ---------------------------------------------------------------------
if [ "${SAPROXY:=-NO-}" = "-YES-" ]; then

ConsoleMessage "Starting SpamAssassin"
#to use as server comment the line before (add a "#" to the beginning), and uncomment the one below (Remove the "#")
/usr/bin/perl /saproxy/ &
#/usr/bin/perl /saproxy/ -listenall &


Note: If you want to use it as a server, that other computers on a network can connect and filter mail, read the file for the /usr/bin/perl line, and adjust accordingly

Save (control “O”), and exit pico (control “X”)

Now we need to set the correct permissions for the file:
sudo chmod 0755 SAProxy

Enter password if asked

Now for the StartupParameters.plist file

o StartupParameters.plist

Paste this in there:

Description = "SpamAssassin Proxy";
Provides = ("SpamAssasin");
Requires = ("Resolver");
OrderPreference = "None";
Messages =
start = "Starting SpamAssassin";
stop = "Stopping SpamAssassin";

Save and exit

Set the permissions for it:

sudo chmod 0644 StartupParameters.plist


Now to configure a mail client, you need the following:

Username user:host.tld
[That is your username for your ISP’s email account, and the host server. For example “”]

Your server is now “localhost”. If your running it on a different computer than the mail client, enter the appropriate IP address.

That’s it.

Sidenote: Hopefully we can get this packaged as a distribution soon, so these directions will be pointless.

Leave a Reply

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