This is an old revision of the document!
This procedure shows you how to install POPfile on Mac OS X 10.4.x systems, and how to create a startup item that will start POPfile each time you reboot the system.
As of Mac OS X 10.4, Mac OS X comes with Perl and SQLite3 installed. So you'll simply need to install Xcode, a few Perl library packages, and a startup item.
Note: Because setting up CPAN, a Perl package manager, or Fink, another package manager, on a virgin system can complicate matters, we'll stick with the source and do it the old-school way to avoid complications.
1. Install Xcode from the CD/DVD that came with your Mac. You may also download it from here:
2. Download the cross-platform version of POPFile from here:
3. Download these Perl library packages (from the CPAN Web Site) and place them all into a folder on your desktop named “packages”:
4. Install each of the Perl library packages you downloaded in the previous step:
<nowiki>cd ~/Desktop/packages</nowiki>
tar xzvf //name//<nowiki>.tar.gz</nowiki>
cd //name//
perl <nowiki>MakeFile.PL</nowiki>
make
sudo make install
5. Enter the command to create a folder to hold POPfile (we suggest ~/Library/POPfile):
mkdir <nowiki>~/Library/POPfile</nowiki>
TIP: ~ means “your home directory”. So ~/Library/POPfile means /Users/yourusername/Library/POPfile.
Note: While this folder can reside anywhere, we suggest you create it somewhere in your home directory so that if you back up your home directory, POPfile gets backed up as well. We assume you have used the location ~/Library/POPfile for the rest of this procedure.
6. Copy or move the POPfile ZIP archive into ~/Library/POPfile folder you just created.
7. Expand the POPfile ZIP archive archive in the ~/Library/POPfile folder. You should now have a bunch of files in ~/Library/POPfile - one of which is popfile.pl.
Note: If the POPfile ZIP archive expands into a sub-folder in ~/Library/POPfile, move all items into ~/Library/POPfile and get rid of the sub-folder.
8. Test your POPfile installation:
cd <nowiki>~/Library/POPfile</nowiki>
perl popfile.pl
9. Create the Mac OS X POPfile startup item:
sudo mkdir -p <nowiki>/Library/StartupItems/POPfile</nowiki>
*b. Create a plain text file named "<nowiki>StartupParameters.plist</nowiki>" in the <nowiki>/Library/StartupItems/POPfile</nowiki> folder with this content:
{
Description = "POPfile mail classification proxy"; Provides = ("popfile"); Requires = ("Network"); Uses = ("Disks", "Network Time", "IPServices"); <nowiki>OrderPreference</nowiki> = "Last"; Messages = { start = "Starting POPfile"; stop = "Stopping POPfile"; };
}
<nowiki> #!/bin/sh # # POPfile - startup script # # For this to work POPfile should be in /Library/POPfile # . /etc/rc.common
PFPATH='/Users/</nowiki>//yourusername//<nowiki>/Library/POPfile' if [ "$1" == "start" ] then pid=$( ps -auxww | grep popfile.pl | grep -v grep | awk '{ print $2 }' )
if ! [ $pid ]; then ConsoleMessage "Starting POPfile mail classification proxy" cd "$PFPATH" perl popfile.pl > /dev/null 2>&1 & fi
elif [ "$1" == "stop" ] then
pid=$( ps -auxww | grep popfile.pl | grep -v grep | awk '{ print $2 }' ) if [ $pid ]; then ConsoleMessage "Stopping POPfile mail classification proxy" kill -6 $pid fi
elif [ "$1" == "restart" ] then
pid=$( ps -auxww | grep popfile.pl | grep -v grep | awk '{ print $2 }' ) ConsoleMessage "Restarting POPfile mail classification proxy" kill -HUP $pid cd "$PFPATH" perl popfile.pl > /dev/null 2>&1 &
fi </nowiki>
sudo mkdir <nowiki>/Library/StartupItems/POPfile/Resources</nowiki>
sudo mkdir <nowiki>/Library/StartupItems/POPfile/Resources/English.lproj</nowiki>
<nowiki> <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist SYSTEM " file://localhost/System/Library/DTDs/PropertyList.dtd" ; ;> <plist version="0.9"> <dict> <key>Starting POPfile</key> <string>Starting POPfile </string> <key>Stopping POPfile </key> <string>Stopping POPfile </string> </dict> </plist> </nowiki>
cd <nowiki>/Library/StartupItems</nowiki> sudo chown -R root.admin popfile cd popfile sudo chmod 754 popfile sudo chmod 644 <nowiki>StartupParameters.plist</nowiki>
10. Finally, to start up POPFile without rebooting enter this terminal command:
sudo <nowiki>/Library/StartupItems/POPfile/POPfile start</nowiki>
TO DO: Add details about the relationship between POPfile, DBD::SQlite2, and the SQLite3 command-line tool included with Mac OS X 10.4.x.
TO DO: Add instructions to edit the popfile.cfg file and change the bayes_dbconnect property to dbi:SQLite2:dbname=$dbname to speed up POPfile launch times.
Should you find anything in the documentation that is incomplete, unclear, outdated or just plain wrong, please let us know and leave a note in the Documentation Forum.