Note: This wiki is now frozen; you can no longer edit it, and no interactive features work.

1. Installer Package for Mac OS X

(based on SpamBayes 1.0.4) I haven't tested this with 10.2 or 10.4, in theory it will work, but you never can tell. I'm working on updating to give better support, but Python is slightly oddly (and very differently) installed on both Panther and Jaguar, and I don't have a copy of Tiger.

At the moment, the installer does not check for existing versions of spambayes, if you're already running it you may want to disable the existing install before using this one.

I just upgraded from 10.3.9 to 10.4.X. It works without any issue.

1.1. Danger Will Robinson!

This package patches SpamBayes to add a "dbm" file type and uses that as the default. On Macs this unfortunately uses Berkeley DB 1.85 under the covers. Very bad. Very, very bad. If you have been using this package you should switch to the pickle format. Now. Do not delay. Here's how.

Everything happens in a Terminal window, so fire up your Mac's Terminal app. You will have to sudo to root because the permissions on the files and directories seem incorrect (at least to me). So, execute sudo bash at the shell prompt and enter your password when prompted. (I assume for this exercise that your user account is an administrative account.)

Stop the POP3 proxy:

/Library/StartupItems/SpamBayes stop
Change directory to the SpamBayes installation:
cd /Library/SpamBayes

Edit your bayescustomize.ini file (vi, ex, Emacs, the TextEdit app, whatever your favorite editor is - just make sure to save it as plain text if you use an editor which likes "rich" formats). Change the persistent_use_database option to pickle and set the persistent_storage_file option to hammie.pck. If you don't have a bayescustomize.ini file for some reason or it's missing either of these options, just make sure you edit or create it so that it contains these lines:

persistent_use_database: pickle
persistent_storage_file: hammie.pck

In that same directory you should have two files, _pop3proxyham.mbox and _pop3proxyspam.mbox. We need to train on them to create the hammie.pck file. Alas, it appears the POP3 proxy created those files incorrectly, adding a spurious From_ line before every message. Execute these two commands to clean up that mess:

sed -e '/^From' < _pop3proxyham.mbox >
sed -e '/^From' < _pop3proxyspam.mbox >

Now execute

/usr/bin/python -p hammie.pck -g -s -f

to generate hammie.pck. Remove the output files from the sed commands:

rm _pop3proxy*

and restart the POP3 proxy:

/Library/StartupItems/SpamBayes start

-- SkipMontanaro

1.2. What's Installed

A self-contained installer package for SpamBayes, it makes an autostarting on boot-up install of the SpamBayes pop3 proxy server.

This is a bit better than the standard install script that comes with spambayes as everything is kept in one place rather than some bits in /System/Library/Python.framework/Version/2.3/bin and some in /Library/Python/2.3 (installing stuff in /System is a bad idea anyway, it's meant for OS/Apple stuff only really).

[WWW]Mac OS X installer pkg

Source: [WWW]Package Source

1.3. Coming Updates:

1.4. Wishlist:

1.5. Revision History:

Sam Thorne

1.6. Tech notes

If there is more than one pop server to proxy and you configure them on, and you mail login are the same but not the passwords, dont store your passwords in the Keychain, you will get error since keychain associate the password with the login and the server name (IP adress in this case) without the port.

2. The definitive ;-) guide for dummies

2.0.1. Please Note:
Although this is a definitive guide to get spambayes up and running from the source tarball, it is not relevant to the Mac OS X Installer Package I put together that this page was originally about, the installer package this page was created for puts spambayes in a different place and sets up a startup script for you, so the following is only relevant if you don't use the installer package linked to earlier in this page.


Sam Thorne

Thanks for adding this, I should have done it myself -- Fran┴ois Granger


After dowloading the package, in the Finder, go to Applications/Utilities and open a terminal windows by double clicking the Terminal icon.

In the terminal window, at the prompt, type in "cd " (with a space after cd) then from the finder, drag the directory (spambayes-1.0rc1) in which SpamBayes has been decompacted and drop it on this terminal window. You should see a line like this one:

[mn:~] login% cd /Users/login/Desktop/spambayes-1.0rc1

Where mn is your machine name, and login is your login name. Hit the [Enter] key.

It should now read:

[mn:~/Desktop/spambayes-1.0rc1] login%

type in "python install" then hit [Enter]. Lines of text scroll on the terminal window. When this is finished, type in "cd" then hit [Enter].

It should now read:

[mn:~] login%

type in "pico sb" then hit [Enter].

Copy and past the following lines inside the Pico window. (Before pasting, replace the login word by your login name):

cd /Users/login/scripts
python -p hammie.db

Type [ctrl-O], then [Enter], then [ctrl-X].

type in "chmod a+x sb" then [Enter].

In the finder, drag and drop the script folder from the spambayes-1.0rc1 folder to your home folder (the one with a house).

Go back to the terminal window and type in "./sb" (yes, dot then slash then s then b) then hit [Enter]. You sould see:

SpamBayes POP3 Proxy Version 1.0rc1 (May 2004)
and engine SpamBayes Engine Version 0.3 (January 2004).

Loading database... User interface url is http://localhost:8880/

SpamBayes is running.

Open your web browser, and in the adress bar, type "http://localhost:8880" then hit [Enter].

You can start configuring spambayes as explained

Before switching off your computer, use the Save & shutdown button in the SpamBayes browser interface to stop SpamBayes.

Each time you restart your computer, before launching you mail software, you should open a terminal windows and type in "./sb" (yes, dot, slash then -s-b-) then hit [Enter].

This could be included in the page ?

Yes it could. Anyone volunteering to create a patch for the page and submit it via sourceforge? Assign it to anadelonbrin and I'll make sure it gets committed and then pushed... --TonyMeyer

A small comment is that if the pickle get defined in bayescustomize.ini:


Then with the command line:

python -p hammie.db
You get an error.

What error? Note that if you switch to a pickle and have an existing database, then you'll need to use to convert it, delete it, or simply use a different name, or you will get an error. Is this what you mean? --TonyMeyer