Moving to Mac OS X: from Thunderbird to Apple Mail

I recently got a shiny new MacBook Pro, and of course have been instantly hooked. In less than a week I seem to have learned my way around with equal proficiency to that other inferior operating system I’ve used for so long.

However, some habits die harder than others. I kept using Thunderbird since all my mail was stored in that format and was tagged up with labels (well, they are actually tags now that its Thunderbird 2.0).

Some guy I know had been raving about how good Apple’s mail was, especially in combination with MailTags and Mail ActOn. I was keen to try it out, but not quite brave enough to switch (and even now, I’m still considering this an experiment). Most of my mail is POP from my ISP, so its stored locally.

Given that Thunderbird can’t read Apple Mail stores and vice versa, I needed a solution that wasn’t all or nothing, and something that would hopefully allow me to read and store my mail on my other machines without going through the POP keep/delete hoops which are a bit gross. I wanted one canonical store.

Given that I don’t run a server constantly, I’ve decided to use my primary machine, the MacBook, to POP all my mail to and run an IMAP server locally to read the mail from both Apple Mail and Thunderbird. The only gotcha will be that I won’t be able to share the incompatible tags, but that’s ok. If I need to move between machines I won’t be using them and I can always open the other client on this one.

So, here’s how I went about it for those that would like to try it. It was fairly straightforward (I’ve never done this before and I was completely set up in 4 hours). Still, I recommend doing some additional reading around each of the steps so you understand what you are doing – you don’t want to lose your mail or turn your box into a SPAM relay.

Set up Postfix

Postfix comes pre-installed on Mac OS X, so all I needed to do here was configure it. I needed 2 things – to change it to use Maildir (IMAP won’t allow subfolders if you are using mbox), and to get it to listen on localhost port 25 so I could relay mail from localhost (not strictly necessary, but I use that so that it is easier to work with the defaults for javamail, for example).

So, editing /etc/postfix/main.cf, I add:

# This is required to get postfix to start up
myhostname = localhost.localdomain
# Use maildir instead of mbox
home_mailbox = Maildir/

You’ll also want to set relayhost if you are going to relay your mail, and be sure to configure the networks to keep that to only come from your machine or network.

Next, to get it to start on boot I followed these instructions (see towards the end).

At this point, I sent a test message:

echo test | mail -s 'foo' brett@localhost

Seeing it arrived in my maildir, I used mail to read it in the terminal.

Set up Dovecot

Dovecot needs to be installed, and unfortunately isn’t in fink, so I used the DarwinPorts version. It’s one release behind at the moment, but I already had it installed before I realised that so I’m sticking with it for now. With DarwinPorts installed, I ran:

sudo port install dovecot

The configuration goes pretty much as the docs say. I created /opt/local/etc/dovecot/dovecot.conf from the example in the same directory and added these options:

default_mail_env = maildir:~/Maildir
mail_extra_groups = mail

I haven’t yet tried the maildir_copy_with_hardlinks = yes setting recommended for performance.

I tried to disable SSL support since I’d only be running this locally, but that dies with a Signal 10 on RC6 from DarwinPorts, so I turned it back on and generated a fake certificate. I copied the dovecot-openssl.conf file from a source distribution I downloaded as I couldn’t find one from the DarwinPorts version. That was used to generate the certificate using mkcert.sh from the same source distribution.

For the PAM settings, I followed those here, but none of the other steps were necessary – DarwinPorts already created the dovecot user and launchd script that just needed to be activated . Instructions for that appear during the installation, but at a later date it can be started using launchctl:

sudo launchctl load /Library/LaunchDaemons/org.macports.dovecot.plist
sudo launchctl start /Library/LaunchDaemons/org.macports.dovecot.plist

So, now that I had dovecot running, I opened up Apple Mail, added an account for it, and checked that my earlier test mail was there. I sent another one for good measure to see it was picked up.

Set up Fetchmail

Update 3/9/06: I removed the fink installation instructions here since the version in there was waaaay out of date. Instead, get fetchmail from BerliOS and follow the normal configure/make/make install steps (also listed in the article below). I’ve updated the launchd configuration below to use /usr/local/bin instead of fink’s /sw/bin.

These instructions are useful for setting it up. I started out with the keep option turned on, but other than that my config was the same. (Update 23/8/06: I’ve since removed the StartupItems entry for FetchMail so that isn’t needed from this guide. See below.)

I turned these all on, tested, and once confirmed it was working, rebooted and it all came up. So now I get to POP my mail regularly, and can read it from both Thunderbird and Apple Mail using IMAP. Next adventures will be moving the existing mail there, and backing it all up!

That’s it! Thanks to John, Jesse and Jason for putting up with my questions on various aspects. I was being extra paranoid, but this ended up working very nicely.

Update 23/8/06: I discovered that under the above set up that fetchmail would stop running whenever I put the macbook to sleep and I’d need to kick it again when I opened it back up. To correct that, I removed the StartupItems entry for FetchMail created above, and created a launchd item instead. This is /Library/LaunchDaemons/de.berlios.fetchmail.FetchMail.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>Label</key>
        <string>de.berlios.fetchmail.FetchMail</string>
        <key>OnDemand</key>
        <false/>
        <key>ProgramArguments</key>
        <array>
                <string>/usr/local/bin/fetchmail</string>
        </array>
        <key>RunAtLoad</key>
<true/>
</dict>
</plist>

I created this using Lingon, which is a nice launchd editor John pointed me at.

Advertisements

6 responses to “Moving to Mac OS X: from Thunderbird to Apple Mail

  1. I made the switch to Mail.app and I regret it. So many times this darn thing just crashed, hung or refused to pick up mails properly. I know it works fine if you don’t have that much mail …and it seems that POP works ok …but with IMAP it’s just a so bad that I spend quite some time building Thunderbird trunk myself with preliminary Addressbook support.

    http://vafer.org/blog/tag/thunderbird

    Was so hoping for the patch to be scheduled for TB 2.0…

  2. Eudora Mailbox Cleaner

    imports thunderbird into Mail, easy and fast.

  3. Dear Brett,

    this could indead become a very nice tutorial on howto setup some kind of free & opensource home kerio mailserver replacement. maybe its already a tutorial for the pros, but i didn’t get trough it. dovecot is running, but not accepting any connections. it would be really cool if you could give me some hints or maybe even cook up a full featured tutorial (hint: googling for dovecot + osx brings you here, so probably many many people out there would be very happy) 🙂

    kind regards & greetings,

    Dave

  4. i forgot to add:
    especially posting all your config files and launch/startup scripts would be very very helpfull! 🙂

  5. I actually moved from offline email to GMail 90% exclusively (at least for my personal e-mail accounts)

    I have things set up so that all POP accounts get forwarded to my Gmail account (even those with Yahoo and Hotmail).

    The only thing I have is a POP client on my local PC for offline backup in case I am away from the net. Gmail also provides you with an SMTP server which records your submissions to your GMail account as well.

    I usually use my Yahoo email ID as a sacrificial lamb for spam bait, but the nice part about the forwarding is I get the benefit of two spam filters (Yahoo and GMail).

  6. Brett, I’ve got DarwinPorts as well, and since I also want to use dovecot only over the loopback interface (I’m sync’ing with another dovecot server using offlineimap), I too wanted to disable SSL. I was able to do so by removing “imaps” and “pop3s” from the “protocols” setting, and adding “ssl_disable = yes”.

    I ran into another problem after I got the server up and running, where I couldn’t login. I was able to fix it via:

    <blockquote><pre>
    ¤ passdb pam {
    ¤¤¤ args = login
    ¤ }
    </pre></blockquote>

    This uses a PAM module which recognizes my Unix login name. Not sure if this is the perfectly Correct solution, but it Works For Me.

    I’m on Mac OS X 10.4.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s