To recover deleted messages, first, you need to know where iMessages are stored on your Mac. By default, iMessages are stored in ~/Library/Messages. However, in some Macs, the iMessages are stored in ~/Library/Containers/com.apple.iChat/Data/Library/Messages/. You can access this directory by opening Finder, then selecting "Go" from the menu bar, and choosing "Go to Folder..." Then enter the path above to access the iMessage cache.