Exporting the OS X Address Book to FOAF

Maintaining my FOAF file involves a lot of work: I have to write RDF/XML by hand, calculate SHA1 hashes, and enter a lot of information that is already stored in a different place: my address book.

That’s why I have created an AppleScript that does all the work for me at the press of a single button. It will even upload the FOAF file to my website using FTP. FOAF on the Mac has never been easier!

The script hasn’t been tested in any other environment, but if you want to try it, here are the instructions. If you do, please comment below and tell us how it works for you.


  • Mac OS X, tested on 10.4 only
  • The script uses Cyberduck, a nice and free FTP client – just download and drop in the /Applications folder

Download and installation

  • Download the Export Address Book to FOAF script and put it somewhere convenient, e.g. into the /Applications folder
  • Double click the script to run it – by default, it will create a file called foaf.rdf on your desktop (be patient, it’s slow)


  • To enable FTP upload, or to customize the location where the foaf.rdf file is created on your hard disk, open the script in Script Editor (found in /Applications/AppleScript), and change the configuration at the top of the file
  • A good configuration would be to upload the file as foaf.rdf to the directory of your home page
  • Save the file

Preparing your card

  • If you don’t have a card for yourself in your address book, then create a new one and choose Make This My Card from the Card menu
  • Provide as much information about yourself as you like

Preparing your public contacts

Optionally, your FOAF file can contain references to some of the people you know – the public part of your social network. To set this up in Address Book:

  • Create a new Group called “Public Contacts” (upper case P and C)
  • Drag some cards to this group
  • It’s good etiquette to only add people who already have some kind of presence on the Web
  • Only their name, home pages, and an encrypted form of their email address will be published by the script; phone numbers, birthdays, notes etc remain private

Weaving the Semantic Web

FOAF files are a part of the Semantic Web, a worldwide decentralized web of data. Optionally, you can add some additional information to your card and the cards of your public contacts, to weave your FOAF file into the Semantic Web.

All of these additional pieces of knowledge go into a card’s URL fields which you can add using Card » Add Field » URL. The green plus adds multiple URLs. There are a number of different URL types, click the label on the left to choose one. Some types may have to be added using the Custom … option. These are the supported types:

home page: The person’s personal home page, if they have one.

weblog: The person’s web log, if they have one. It doesn’t really matter if you choose home page or weblog.

work: The home page of the person’s employer, department, or group.

img: An image of the person on the Web. This works only for your own card.

URI: If the person has chosen a URI to identify herself, then add it with this label. You can also use this for yourself. My URI, for example, is http://richard.cyganiak.de/foaf.rdf#cygri.

RDF: For those of your public contacts who already have a FOAF profile, you can add the profile’s URL using this label. Please do this if you can spare a bit of time. For yourself, you can use this label to add other RDF files that contains additional information about you.

Make sure that all URLs include the leading http:// bit.

As I said above, feedback is very welcome.

This entry was posted in General, Semantic Web. Bookmark the permalink.

3 Responses to Exporting the OS X Address Book to FOAF

  1. Floroskop says:

    I think this try.

  2. Engigaccics says:

    Hi people!
    The interesting name of a site – dowhatimean.net
    I recently 9 hours
    sat in the Internet So I have found your site :)
    The interesting site but does not suffice several sections!
    However this section is very necessary!
    I have added you in elected!
    Forgive I is drunk :))

  3. sandrar says:

    Hi! I was surfing and found your blog post… nice! I love your blog. :) Cheers! Sandra. R.

Comments are closed.