Installing POPFile on Mac OS X

popfile_logo.gifSpam sucks the whole day long.

I’ve used many different programs to filter spam out of my inbox, and what I’ve found works the best is a combination of Spam Assassin running on the server, and the open source POPFile running locally. I’m running at around a 99.5% accuracy rate, with zero false positives.

The other great benefit of POPFile is that it doesn’t just filter spam. You can set it up to use Bayesian filtering for all kinds of email. POPFile filters email into “buckets”, and learns what kind of email belongs in what bucket as you train it. I have buckets for personal email, email subscriptions, email from clients, and of course, for spam. POPFile can add a header to the email with the bucket it thinks the email belongs in, or can also add a prefix to the subject line.

You then set up your email client to fetch email through POPFile, and filter on the header, or the subject line. It kicks butt, and is way easier to set up than my rambling explanation would belie.

The new version of POPFile has been greatly changed to now use the BerkeleyDB software to store its information and data in. This means that POPFile is much, much faster than before. This also means that the install process is that much more difficult.

Here, I’ve documented what I did to get POPFile 0.2.0a running on Mac OS X. I’m definitely no Unix or Perl guru, so these instructions should definitely be taken with a big ol’ your mileage may vary. But, after fussing with it for a while, I think I’ve got it figured out.

Drop me a line if these instructions help you get POPFile and the BerkeleyDB installed successfully. I’ll try to help if you have problems, but like I said, I’m no expert.

(This assumes that you have the free Apple Developer Tools installed on your system.

  1. First, we need to install the BerkeleyDB software. Download the latest BerkeleyDB release from SleepyCat Software. It’s free.
  2. Unpack the file:
    tar -zxf db-4.1.25.NC.tar.gz
  3. Change directories into the resulting folder:
    cd db-4.1.25.NC
  4. Change directories into the unix build directory:
    cd build_unix
  5. Run the configuration setup:
  6. Run make:
  7. Now install the bugger. You’ll have to type in your admin password after hitting return:
    sudo make install
    Go and have a coffee now, as this will take a while.
  8. Once it’s finished, and you have a command prompt again, we’ll need to install the module that allows Perl to hook into the BerekelyDB. You can download it from CPAN.
  9. Unpack the file, as before:
    tar -zxf BerkeleyDB-0.24.tar.gz
  10. Change directories into the folder:
    cd BerkeleyDB-0.24
  11. Now (and this is the part that screwed me for quite a while), we’ll need to make a change to the file. I used pico to edit it:
  12. Change the following lines:
    INCLUDE = /usr/local/BerkeleyDB/include to INCLUDE = /usr/local/BerkeleyDB<strong>.4.1</strong>/include

    LIB = /usr/local/BerkeleyDB/lib to LIB = /usr/local/BerkeleyDB<strong>.4.1</strong>/lib</blockquote></li> <li>Once you've made these changes, press <code>control + x to exit out of pico, and hit enter to save your changes.
  13. Now we can run the makefile:
    perl Makefile.PL
  14. Run make:
  15. Run the install - you may need to put your admin password in again, but this time the install should be really fast.
    sudo make install
  16. Now, finally, you can install POPFile. Download it from the sourceforge site, and decompress it using Stuffit Expander or some other similar program.
  17. Upgrading from a previous version of POPFile: You’ll have to stop POPFile from running before we move on. Log into the interface (this link should open the POPFile screen) and click the “Shutdown POPFile” link in the top right-hand corner. I also recommend backing up your old install of POPFile before you proceed.
  18. For new POPFile users: All you have to do now is to create a POPFile folder in the top-level Library folder of your hard drive (not the Library folder in your home directory - the global Library folder), and copy the contents of the popfile-0.20.0a Folder into it.

    For POPFile updaters: Copy the contents of the popfile-0.20.0a Folder folder into your existing POPFile folder, allowing it to overwrite existing files. You did do a backup, right?
  19. You now should be able to start up POPFile. The best way to do this is via a startup item, so that POPFile starts when you log into your computer. Download this file, decompress it using Stuffit, and copy the resulting folder into your StartupItems folder located in the global Library folder (located Harddrive > Library > StartupItems)
  20. Open a terminal window again, and change directories into the popfile folder you just moved.
    cd /Library/StartupItems/popfile
  21. Startup POPFile. You need to put your admin password in again.
    sudo ./popfile start
  22. You should see a “popfile started” or something like that. If you a new POPFile user, that’s it! Now you just need to start configuring your buckets. See the POPFile manual for more details on how to do this.
  23. Previous users of POPFile will see a long import process as POPFile moves your existing buckets and corpus files into the BerkeleyDB.

(Edit (Nov. 10, 2003): I’ve created a POPFile skin which makes POPFile look a little bit more OS X friendly. If you’re interested, check out the screenshot and installation instructions.)

ISSN 1499-7894
Recent Posts
Contact Archives Web Love Writing Photos FAQs Home