How can I find and replace addresses in Apple Mail and Address Book?

Q:One of our clients is changing their email address domain name. Is there a way to find and replace all instances of a domain name in Address Book?

Like many of you reading this, I hate doing repetitive work. Yes, there is a way to do this, but it is not built into Apple Mail or Address Book. Like many things in Mac OS X, the underpinnings of the Mac OS X Address (or “” as it is now referred) is a MySQL database. There are actually two of them that I recommend editing in a situation like this, as many of the addresses that we use are not actually being pulled from Address but are actually coming from’s “Previous Recipient List”. These two files are both found inside the “~/Library/Application Support/AddressBook” folder.

Like all MySQL databases in Mac OS X, you can modify that database directly should the need arise to do so and thankfully Apple has included the command-line application sqlite3 as part of Mac OS X to do just that. Most people won’t want to start fussing around with sqlite3 commands so I went ahead and put together a small application with AppleScript called “Address Swap” that can do a find and replace in both your local Address Book as well as the Previous Recipients List in Apple Mail. Here is how it works:

  1. First, the script will inform the user that it only updates local entries and does not change addresses synchronized using iCloud. It will also inform you that it will attempt to make a dated disk image backup of your “AddressBook” Application Support files prior to running.
    NOTE: You are responsible for your own backups. TECH90 takes no liability for your data. This application is being provided freely to the world and is licensed under the GNU GPL.
  2. Next, the script will ask you what you would like to replace in your addresses. Typically, this will be a domain name. So if TECH90 was changing its email addresses from TECH90.COM to TECH90.NET, in the first field, you would enter “”.
  3. Next, the script will ask you what you would like to replace that text with. So for our example, we would enter “”.
  4. The script will now attempt to backup your “AddressBook” Application Support folder which contains the two databases that it edits. It will also quit and Address since it is editing files used by those two programs. It will notify the user of this information and make sure that it is OK with the user to do so. No files have been edited at this point. Clicking the “OK” button on this screen will begin the process of creating and editing files.
    NOTE: There is no visual progress bar indicating that the script is working, you will notice a file titled “AddressBook-Backup.dmg” appear on your desktop and when the script has completed its processes, it will alert the user that the process is finished and offer to relaunch Apple Mail.
  5. That’s it! Once the script finishes, you should see your requested address changes in both Apple and Address (or

You can find the download for this AppleScript app HERE.

If you found this little tool helpful, post a note below letting me know it was helpful.