Skip to content

Instantly share code, notes, and snippets.

@0xced
Created March 11, 2010 21:25
Show Gist options
  • Save 0xced/329671 to your computer and use it in GitHub Desktop.
Save 0xced/329671 to your computer and use it in GitHub Desktop.
Use your own Address Book in the iPhone Simulator
#!/bin/bash
cd ~/Library/Application\ Support/MobileSync/Backup
backup=`ls -t1 | sed -n '1p'` # most recent backup
for f in "$backup"/*.mdinfo; do
grep -q "Library/AddressBook/AddressBook.sqlitedb" $f
if [ $? -eq 0 ]; then
addressbook=`basename $f .mdinfo`
cp -v "`pwd`/$backup/$addressbook.mddata" ~/Library/Application\ Support/iPhone\ Simulator/User/Library/AddressBook/AddressBook.sqlitedb
exit $?
fi
done
echo "Address Book not found in iPhone backup" >&2
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment