Sync and clean up contacts when switching between Google/Android and iOS/iPhone. Automatically merges duplicates and optionally filters out unwanted contacts.
# Install dependencies
uv venv && uv sync
# Merge all contacts and remove duplicates
uv run scripts/create_master_contacts.py --google data/input/google_contacts.vcf --ios data/input/icloud_contacts.vcf
# Optional: Filter out unwanted contacts
cp config/filter_config.example.yaml data/filter_config.yaml
# Edit data/filter_config.yaml with your exclusion rules
uv run scripts/filter_contacts.py --input data/output/master_contacts.vcf
# Import the result to your iPhone via iCloud.comcontacts/
├── scripts/ # Main scripts
│ ├── create_master_contacts.py
│ ├── filter_contacts.py
│ └── merge_contacts.py
├── lib/ # Core libraries
│ ├── vcard_parser.py
│ └── detect_duplicates.py
├── config/ # Configuration templates
│ └── filter_config.example.yaml
├── data/ # Your data (git-ignored)
│ ├── input/ # Contact exports
│ └── output/ # Generated files
├── pyproject.toml
└── README.md
- Merges contacts from Google Contacts and iCloud exports (vCard format)
- Automatically deduplicates based on phone numbers, emails and name matching
- Optionally filters out unwanted contacts (old employers, etc.)
- Generates clean vCard files ready for iPhone import
Install uv and set up the project:
curl -LsSf https://astral.sh/uv/install.sh | sh
uv venv
uv syncAll dependencies are defined in pyproject.toml.
From Google Contacts:
- Go to contacts.google.com
- Click "Export" → Select "vCard format (for iOS Contacts)" → Export
- Save to
data/input/google_contacts.vcf
From iCloud (optional):
- Go to icloud.com → Contacts
- Select All → Click gear icon → Export vCard
- Save to
data/input/icloud_contacts.vcf
uv run scripts/create_master_contacts.py --google data/input/google_contacts.vcf --ios data/input/icloud_contacts.vcfThis creates data/output/master_contacts.vcf with all duplicates merged.
To exclude old contacts from specific organizations or email domains:
# Copy and edit the filter config
cp config/filter_config.example.yaml data/filter_config.yaml
# Edit data/filter_config.yaml with your exclusion rules
# Apply filters
uv run scripts/filter_contacts.py --input data/output/master_contacts.vcfThis creates data/output/filtered_contacts.vcf.
Option A: Mac Contacts.app (recommended for 1,000+ contacts)
Mac's Contacts app has no import limit and syncs automatically via iCloud:
- Enable iCloud Contacts sync: System Settings → Apple ID → iCloud → Contacts (on)
- Open Contacts.app
- File → Import → Select your file (
filtered_contacts.vcformaster_contacts.vcf) - Wait for import to complete
- Contacts sync to iPhone automatically (check after 1-2 minutes)
Option B: iCloud.com web interface (for lists under 1,000 contacts)
Note: iCloud.com has an ~1,000 contact import limit. Use Option A for larger files.
- Go to icloud.com → Contacts
- Click gear icon → Import vCard
- Select your file (
filtered_contacts.vcformaster_contacts.vcf) - Wait for sync (check your iPhone after a few minutes)
data/output/master_contacts.vcf- Merged and deduplicated contactsdata/output/filtered_contacts.vcf- Master contacts with filters applied (if using filters)data/output/merge_log.txt- Log showing which contacts were mergeddata/output/exclusion_report.txt- Report of filtered contacts (if using filters)