You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fatal error: Uncaught PDOException: SQLSTATE[HY000] [14] unable to open database file in /Users/edmondchuc/projects/iMessage-Export/include.php:4
Stack trace:
#0 /Users/edmondchuc/projects/iMessage-Export/include.php(4): PDO->__construct('sqlite:/Users/e...')
#1 /Users/edmondchuc/projects/iMessage-Export/contacts.php(3): include('/Users/edmondch...')
#2 {main}
thrown in /Users/edmondchuc/projects/iMessage-Export/include.php on line 4```
Am I doing something wrong?
The text was updated successfully, but these errors were encountered:
Looks like MacOS has some sort of protections on the ~/Library/Messages directory that prevent command line programs from being able to access it– looks like the same sort of thing happens if you try to run ls ~/Library/Messages (even with sudo).
I didn't look too much into why this is the case, but if you're looking for a quick workaround, open up the messages folder with Finder:
$ open ~/Library/Messages
then copy the chat.db file onto your desktop. You can then open include.php and change the first line to this:
I was able to fix this on macOS Catalina without copying the chat.db file by going into System Preferences > Security > Privacy > Full Disk Access and enabling my terminal which I used to run php contacts.php (which had previously thrown the same error OP mentioned). I was using the default macOS Terminal app.
When I run
php contacts.php
I getThe text was updated successfully, but these errors were encountered: