How do I give Codex my Apple Health data?
Install the HealthSQL iPhone app, then on your Mac run curl -fsSL https://healthsql.app/install | sh and healthsql connect codex, which registers HealthSQL with Codex as an MCP server. Codex can then answer questions about your Health data through two read-only tools, or run healthsql query as a shell command.
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. Codex is OpenAI's coding agent. It has no Apple Health connection of its own, and OpenAI's help page for ChatGPT's Health feature does not mention Codex (what ChatGPT Health covers).
Connect over MCP
healthsql connect codexThis runs codex mcp add healthsql -- ~/.local/bin/healthsql mcp, the form OpenAI's docs give for a local server: codex mcp add <server-name> -- <stdio server-command>. To do it by hand instead, add this to ~/.codex/config.toml, the file Codex reads by default:
[mcp_servers.healthsql]
command = "/Users/you/.local/bin/healthsql"
args = ["mcp"]Use your own full path; healthsql connect with no name prints it. OpenAI's docs say the ChatGPT desktop app, the Codex CLI and the IDE extension share this configuration, so one registration covers all three (OpenAI, MCP in Codex, read 30 November 2026).
The server gives Codex health_overview, which describes your data, and health_query, which runs one read-only SQL query. Details: Apple Health MCP server.
Use it from the shell
Codex can also run healthsql and healthsql query "SELECT ..." like any other command. OpenAI's docs say Codex runs local commands in a sandbox that limits what they can touch, typically to the current workspace, and asks for approval to edit files outside it (OpenAI, sandboxing, read 30 November 2026). The command reads the iPhone's files in iCloud Drive and updates its database in ~/Library/Application Support/HealthSQL, both outside a workspace, so expect Codex to ask before it runs the command. MCP is the simpler route for Codex.
Questions to try
- "Use healthsql. How did my resting heart rate and HRV change over the last eight weeks?"
- "From my workouts, list every run this year with its distance and average heart rate, and write them to runs.csv."
- "Compare my sleep on weekdays and weekends over the last three months."
- "Plot my weekly average steps for this year and save the chart as steps.png."
For daily numbers, Codex should read the daily view, which holds Apple Health's own totals; the server tells it so. The full rules are in the schema reference.
Questions
Does Codex have Apple Health built in?
No. As of November 2026, OpenAI's Health feature works inside ChatGPT's chats, and its help page does not mention Codex (OpenAI). Codex reads Health data through a tool on your Mac, such as HealthSQL.
Where does the data go when Codex reads it?
The database stays on your Mac. The rows Codex reads enter its context and go to OpenAI, as anything you type to it does. Ask for summaries when you do not need every sample.
Does it work in the ChatGPT desktop app?
In Codex inside the ChatGPT desktop app, yes: OpenAI's docs say it shares the same MCP configuration as the CLI. The app must run on the Mac that has the files.
What about Claude Code and Cursor?
The same command connects them: healthsql connect claude-code or healthsql connect cursor. See Claude Code and Cursor.