This is an old revision of the document!
Table of Contents
Exporting iPhone Text Messages
Over time, text messages and their attachments (photos, videos, etc.) can accumulate and take up a significant amount of space on both your iPhone and Mac. If you’ve been using your devices for years, you might notice that these files can easily take up over 50GB of storage.
This page walks you through the process of exporting and backing up your text messages, along with their attachments, so you can safely clear up space on your devices. It also provides info about other export options.
Install Tools
1. Install Cargo:
curl https://sh.rustup.rs -sSf | sh
2. Install imessage-exporter using Cargo:
cargo install imessage-exporter
3. Install FFmpeg (or another MOV converter):
If you don't have FFmpeg installed, you may see an error about video conversion when exporting messages. Use Homebrew to install it:
brew install ffmpeg
Bulk Export and Backup
1. Export Messages (by year or by quarter):
Use the following command to export text messages, including attached videos and pictures, from January 1, 2025, to March 31, 2025. The export will be saved in a folder named 2025-jan-mar in your current directory:
imessage-exporter -c clone -f html -o 2025-jan-mar -s 2025-01-01 -e 2025-03-31
For more parameters and options, refer to the official README.
2. Set iPhone to Automatically Delete Messages Older Than 1 Year:
Go to Settings > Messages on your iPhone and enable the option to delete messages and attachments older than 1 year. For guidance, see the official Apple support article: Delete messages and attachments.
3. Backup Your Text Messages Every 3-6 Months:
Regularly export, zip, and back up your messages to keep your devices free from unnecessary data while retaining important memories.
Specific Person or Number
You can use specific flags with imessage-exporter to isolate a single person and export only the text.
1. Target One Specific Person
You can use the conversation filter flag (-t or –conversation-filter) followed by the person's phone number, email address, or contact name.
2. Export Just the Text
Instead of exporting to HTML (which formats everything nicely and links attachments), you can switch the format flag (-f) to txt. By default, if you don't use the -c clone flag, it won't copy over all the heavy media attachments.
3. The Command
Combine these options into a single terminal command:
imessage-exporter -f txt -t "Contact Name or Phone Number" -o "MySingleExport"
Tip: If you use a phone number, include the country code (e.g.,+15558675309). If you use a name, put it in quotes just like the example above.
