run backup on icloud encrypt, since it gives more run .\imessage-exporter.exe -f html -c clone -a iOS -p "$env:USERPROFILE\Apple\MobileSync\Backup<device-id>" -o .\messages_export
either get latest release of imessage-exporter (apple version) https://github.com/ReagentX/imessage-exporter/releases/tag/4.2.0
or use Homebrew (easier, auto-updates): https://brew.sh/ brew install imessage-exporter
make sure mac has enough disk space (~60GB) run df -h in a terminal
Open Finder. Your iPhone appears in the left sidebar under Locations. Click it.
On the General tab, choose "Back up all of the data on your iPhone to this Mac."
Tick "Encrypt local backup" and set a password. Write it down/don't forget it, we'll need it later
Click Back Up Now. This can take an hour or more and uses a lot of disk space
Open System Settings (the gear icon). Click Privacy & Security in the left sidebar. Scroll down and click Full Disk Access. Find Terminal in the list and switch it on. If Terminal isn't listed, click the + button, then go to Applications → Utilities → Terminal. It will ask you to quit and reopen Terminal. Do that — quit Terminal completely (Command + Q) and open it again.
Lists all backups, should hopefully be just one:
ls ~/Library/Application\ Support/MobileSync/Backup/
The name of this is the backup/device id, looks like 00008120-000A1B2C3D4E5F6G
Replace "PASTE-HERE" with your backup's id: imessage-exporter -f html -c clone -a iOS -o ~/Documents/My-Messages -p ~/Library/Application\ Support/MobileSync/Backup/PASTE-HERE
There should now be a directory 'My-Messages' in your 'Documents' folder. Each thread is a separate file which opens in your browser.