Why is Apple's export.xml hard to use with AI, and what can I do instead?
Export All Health Data gives you one zip with an XML file that holds every record you have, often gigabytes of it, and it is out of date the day after you make it. A model cannot read that much at once, and an agent that converts it to a database still needs you to repeat the export by hand each time you want current data; a database kept current from the phone avoids both.
What the export is
Apple's own description: "You can export all of your health and fitness data from Health in XML format." In the Health app, tap Summary, then your picture or initials, then Export All Health Data, and share the file to your Mac (Apple, Share your health data, as of November 2026).
It is the only way Apple gives you your whole record in one go, and for a one-time look at your history it is fine.
Why it fails with AI
It is too big to read. Every sample is its own XML element with every attribute spelled out, and a Watch records heart rate many times an hour, every day, for years. One developer on Hacker News put it at about 1 to 2 GB of XML per year of data (Hacker News, July 2025). A gigabyte of text is hundreds of millions of tokens, far more than any model reads at once, so uploading it to a chat does not work. An agent has to parse it into something it can query first.
It is old the next day. The export is a snapshot. To ask about this week, you make a new one: open Health, wait for the export, move the file, run the converter again. That routine is easy to stop doing, and then your agent answers from last month.
It has no daily totals for steps. For steps, distance and energy the file holds the raw samples of every device. Your Watch, your iPhone and a ring each recorded the same walk, so a plain sum counts it two or three times. The totals the Health app shows are not in the file; you have to rebuild them. Why sums double count.
What to do instead
For a one-time look at old history, the export is enough. Do not paste it into a chat. Ask a coding agent such as Claude Code or Codex to stream the XML into SQLite with an incremental parser (in Python, xml.etree.ElementTree.iterparse), then query that. Keep the daily-total problem in mind when you sum.
For questions about your life as it goes on, use a copy that stays current by itself. HealthSQL is an iPhone app and a command-line tool that copy your whole Apple Health record into a local SQLite database on your computer, so AI agents can query it with SQL or MCP. The iPhone app writes only what is new, as compressed JSON lines, so after the first export each update is small. It stores Health's own daily totals beside the raw samples. Each answer says when the phone last synced.
| export.xml | HealthSQL | |
|---|---|---|
| Getting new data | A new export, by hand | The app exports what is new; with the $7.99 purchase it runs by itself |
| Size of an update | The whole history, every time | Only the new records |
| Daily totals | Not included; you compute them | Health's own totals, in daily and days |
| How an agent reads it | You convert it first | SQL from a shell, or MCP |
Other apps also export Health data as it changes, to files, servers or services; HealthSQL and Health Auto Export compares one of them.
Questions
What does HealthSQL leave out?
A few types that iOS gives apps through separate permissions or not at all: clinical records, medications, vision prescriptions, ECG voltages, heartbeat series and audiograms (export format).
Can an AI agent convert export.xml for me?
Yes. Claude Code or Codex can write a streaming converter to SQLite. The result is as old as the export, though, and the conversion has to be run again after every new export.