Skip to main content

abcddb2vcard

This python script reads an AddressBook database file (AddressBook-v22.abcddb) and export its content to a vCard file (.vcf).

I created this script to automate my contacts backup procedure. The output of this script should be exactly the same as dragging and dropping the "All Contacts" card.

Installation

To install abcddb2vcard from PyPi, use pip:

pip install abcddb2vcard

abcddb2vcard can then be used from any working directory in the Terminal.

To uninstall:

pip uninstall abcddb2vcard

Usage

Export all contacts

abcddb2vcard backup/contacts_$(date +"%Y-%m-%d").vcf

Export into individual files

abcddb2vcard outdir -s 'path/%{fullname}.vcf'

Extract contact images

vcard2img AllContacts.vcf ./profile_pics/

Usage help

abcddb2vcard

usage: abcddb2vcard [-h] [-f] [--dry-run] [-i AddressBook.abcddb] [-s FORMAT]
                    outfile.vcf

Extract data from AddressBook database (.abcddb) to Contacts VCards file
(.vcf)

positional arguments:
  outfile.vcf           VCard output file.

optional arguments:
  -h, --help            show this help message and exit
  -f, --force           Overwrite existing output file.
  --dry-run             Do not write file(s), just print filenames.
  -i AddressBook.abcddb, --input AddressBook.abcddb
                        Specify another abcddb input file. Default:
                        ~/Library/Application Support/AddressBook/AddressBook-v22.abcddb
  -s FORMAT, --split FORMAT
                        Output into several vcf files instead of a single
                        file. File format can use any field of type Record.
                        E.g. "%{id}_%{fullname}.vcf".

vcard2img

usage: vcard2img [-h] infile.vcf outdir

Extract all profile pictures from a Contacts VCards file (.vcf)

positional arguments:
  infile.vcf  VCard input file.
  outdir      Output directory.

optional arguments:
  -h, --help  show this help message and exit

Supported data fields

  • firstname
  • lastname
  • middlename
  • nameprefix
  • namesuffix
  • nickname
  • maidenname
  • phonetic_firstname
  • phonetic_middlename
  • phonetic_lastname
  • phonetic_organization
  • organization
  • department
  • jobtitle
  • birthday
  • [email]
  • [phone]
  • [address]
  • [socialprofile]
  • note
  • [url]
  • [xmpp-service]
  • image
  • iscompany

Limitations

Currently, the image field only supports JPG images. But as far as I see, Apple converts PNG to JPG before storing the image. If you encounter a db which includes other image types, please let me know.

Disclaimer

You should check the output for yourself before using it in a production environment. I have tested the script with many arbitrary fields, however there may be some edge cases missing. Feel free to create an issue for missing or wrong field values.

Note: The output of diff or FileMerge.app can be different to this output. Apple uses some data transformations (on vcf export) which are not only unnecessary but may break the re-import of the file.

Metadata

Release files for abcddb2vcard 1.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for abcddb2vcard 1.2.2
File Size Uploaded Provenance
abcddb2vcard-1.2.2.tar.gz 11.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for abcddb2vcard 1.2.2
File Interpreter ABI Platform
abcddb2vcard-1.2.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / abcddb2vcard-1.2.2.tar.gz

Download URL abcddb2vcard-1.2.2.tar.gz
Size 11.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7ca206375da97e1e2425abb93555f6fd52d6ccf4abadfbd9d0914726e6f6ac28
BLAKE2b-256 checksum
How to use checksums
f3dc4dc2b710204611bdb2ea345e626d622c69a8538e91a5ca45feeaa8b58f07
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / abcddb2vcard-1.2.2-py3-none-any.whl

Download URL abcddb2vcard-1.2.2-py3-none-any.whl
Size 12.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a5e2f00d745c1663250325e1668f5c9e45d03262befebdd5bee49c358cf45e0
BLAKE2b-256 checksum
How to use checksums
0d20c8b7eae75f20e0b89cf51185672f68d9e26bde6c295f4ad8b42744d8ff4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Security for abcddb2vcard 1.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page