I had an issue on my Mac Mini (with macOS 10.15 Catalina) in that it didn’t want to send images in the Messages app anymore. Texts could through fine, but every time I added an image, it tried to send it for several minutes and always aborted with a “can’t deliver” error. Subsequent attempts to re-send also failed. This happened just around the time when Apple switched off Photostream, but thankfully this was not related.
The solution was to delete the Messages database and start with a clean slate. Here’s how I did it:
- close the Messages app
- click on an empty space on your Desktop, so that Finder is visible at the top
- hold down OPTION/ALT and click Go
- select Library (this is hidden, unless you hold down OPTION)
- find the Messages folder
- delete both .db files (chat.db and prewarm.db)
- restart your Mac
When you start Messages again, it should have finished rebuilding the database and you’ll start with a “clean slate” and no messages. Lo and behold, sending images works again like a charm.
To bring back your previous messages, head over to Messages – Preferences – iMessage and enable Messages in iCloud.
For the curious, the files you see in the Messages folder are all related to Core Data, the framework that Apple have used for many years to store and retrieve data in the underlying SQLite database. Developers shouldn’t really touch these files directly and instead always rely on the Swift/Objective-C calls to access and modify data. What we’d need to to programmatically here is to tear down the Core Data Stack for a clean start, but since there’s no built-in menu option to do that, we’re bringing this about by brute force. This will trigger a fail safe, and the stack is rebuilt.
Thanks to pungme for this tip!