Skip to content

Instantly share code, notes, and snippets.

@adriannier
Last active June 13, 2024 03:43
Show Gist options
  • Save adriannier/fcad64dc90001da8a4235a020ec35d10 to your computer and use it in GitHub Desktop.
Save adriannier/fcad64dc90001da8a4235a020ec35d10 to your computer and use it in GitHub Desktop.

Dump schema

sqlite3 Accounts4.sqlite .schema

Dump data

sqlite3 Accounts4.sqlite .dump

Apply changes to main database file
Make sure to make copies of the original files and only work on those duplicates. This process should reduce the size of the Accounts4.sqlite-wal to 0 bytes.

sqlite3 Accounts4.sqlite vacuum

List primary key, account description and user name of all Mail accounts

sqlite3 Accounts4.sqlite 'SELECT Z_PK, ZACCOUNTDESCRIPTION, ZUSERNAME FROM ZACCOUNT WHERE ZOWNINGBUNDLEID = "com.apple.mail"'

Show email addresses for the account with primary key 11

sqlite3 Accounts4.sqlite 'SELECT hex(ZVALUE) FROM ZACCOUNTPROPERTY WHERE ZKEY = "IdentityEmailAddress" AND ZOWNER = 11' | xxd -r -p > ~/Desktop/dumped.plist && plutil -convert xml1 ~/Desktop/dumped.plist && cat ~/Desktop/dumped.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment