Skip to content
HomeKit.sh Get HomeKit.sh

HomeKit.sh

Your home.
In every terminal and agent.

HomeKit.sh lets you and your AI agents control every HomeKit and Matter accessory from the command line. Lights, locks, thermostats, appliances, scenes and cameras. Paste one prompt into your agent and it sets everything up.

Download HomeKit.sh

Runs on macOS 15.2 or later. A 107 KB download with the CLI, the bridge source, a Windows client and the agent skill.

Set up with your agent.

Copy the prompt for your computer and paste it into Claude Code, Codex, Cursor or any agent with a terminal. It downloads HomeKit.sh, installs it, and teaches itself the commands.

Prompt for an agent on the Mac with your home
Set up HomeKit.sh on this Mac so you can control my HomeKit and Matter home from the terminal.

1. Download https://rerehome.app/mcp/HomeKit.sh.zip and unzip it to ~/Desktop/HomeKit.sh.
2. Install jq if it's missing (brew install jq).
3. In ~/Desktop/HomeKit.sh, run ./install.sh. It puts homekit.sh on my PATH and installs the homekit skill in ~/.claude/skills/homekit. If you aren't Claude Code, read skills/homekit/SKILL.md now and follow it whenever I mention a light, room, accessory, scene, camera or "the house".
4. Build the bridge, the small Mac Catalyst app that holds the HomeKit connection. Follow bridge/README.md, then run ./install.sh --bridge. It needs my Apple Development certificate and a Mac Catalyst development provisioning profile with the HomeKit capability at bridge/embedded.provisionprofile. Use my own bundle ID through BUNDLE_ID. If a step needs my Apple Developer account, stop and tell me exactly what to do.
5. When macOS asks to allow HomeKit access, tell me so I can click Allow.
6. Check it works with homekit.sh bridge status and homekit.sh ls, then show me what you found.

While testing, only read values. Don't change locks, garage doors, security systems or anything else that acts on the physical world.

Or install it yourself.

Four steps on the Mac that has your home. HomeKit only works inside an app, so a small bridge app holds the connection and homekit.sh talks to it.

  1. Download and unzip

    Get HomeKit.sh and put it somewhere permanent. The agent skill expects ~/Desktop/HomeKit.sh.

    curl -LO https://rerehome.app/mcp/HomeKit.sh.zip
    unzip HomeKit.sh.zip -d ~/Desktop && cd ~/Desktop/HomeKit.sh
  2. Install the CLI and the skill

    Links homekit.sh into your PATH and the skill into ~/.claude/skills/homekit. It needs jq.

    brew install jq
    ./install.sh
  3. Build the bridge

    The bridge is a Mac Catalyst app with the HomeKit entitlement, so it needs a paid Apple Developer account. Create an App ID with HomeKit, download a Mac Catalyst development profile for it to bridge/embedded.provisionprofile, and build. bridge/README.md walks through each step, including with the asc CLI.

    BUNDLE_ID=com.example.homekitsh ./install.sh --bridge

    The first time it runs, macOS asks to let HomeKit.sh access your home. Click Allow. The bridge then starts at login.

  4. Check it

    You should see your homes, then every accessory and what it can do.

    homekit.sh bridge status
    homekit.sh ls

The agent skill.

One Markdown file teaches an agent every command, how to pick the right accessory, and when to ask first. install.sh adds it to Claude Code for you. For any other agent, copy it into the agent’s instructions or rules file.

Claude Code

Installed by ./install.sh. To add it by hand:

mkdir -p ~/.claude/skills/homekit
curl -o ~/.claude/skills/homekit/SKILL.md \
  https://rerehome.app/mcp/SKILL.md

Codex, Cursor and others

Paste the skill into AGENTS.md, your rules file or your custom instructions.

View raw
Read the skill
---
name: homekit
description: Control and read the user's real HomeKit and Matter home from the terminal with HomeKit.sh (homekit.sh on a Mac, Linux/WSL/Git Bash via a relay, or HomeKit.ps1 / the HTTP API on Windows), lights (on/off, brightness, any color, white temperature), thermostats, locks, garage doors, blinds, fans, purifiers, humidifiers, TVs, speakers, valves/faucets, robot vacuums and Matter appliances (dishwashers, washers, ovens, EV chargers…), scenes, and cameras (snapshot to clipboard, live window, local stream URL). Use whenever the user mentions a light, room, accessory, scene, camera or "the house", including deferred requests like "make the studio orb green when this is all done" or "flash the office light when the build finishes".
---

# HomeKit via HomeKit.sh

`homekit.sh` talks to the **HomeKit.sh bridge**, a small Mac Catalyst agent that
has HomeKit + Matter access. Every command waits for HomeKit's answer and exits:
`0` ok · `1` failed · `2` ambiguous / not found (candidates printed) · `3` bridge/relay unreachable.

If `homekit.sh` isn't on PATH, it lives at `~/Desktop/HomeKit.sh/homekit.sh`
(`homekit.sh` is the old name and still works).

## Deferred requests ("…when this is all done")

Do the user's actual task first. When it's finished (and verified), run the
home command as your **last step**, then mention it in your final message.
If the work ends in a background process (build, test run, deploy), chain the
command onto that process instead of guessing when it ends:

```sh
xcodebuild … ; homekit.sh set "studio orb" color green
```

To signal the outcome, use two colors: green when it worked, red when it didn't.

```sh
if make test; then homekit.sh set "studio orb" color green; else homekit.sh set "studio orb" color red; fi
```

## Targets

Say accessories the way a person would: `"studio orb"`, `"Orb"`, `"kitchen lights"`,
`"everything in the studio"`, `"all fans"`, a Home-app group name, or an accessory UUID.
Room + name is the safest ("studio orb", not "orb"). Plurals and "all" target groups.

On **exit 2** the bridge prints candidates (`Studio › Orb`, `Kitchen › Orb`…). Pick
one from context and retry with the room in the name. If context doesn't settle it,
ask the user. Never guess between locks, garage doors or security systems.

Discover first when unsure: `homekit.sh find "<words>"` or `homekit.sh ls` (every
accessory, its state, and what it can set).

## Doing things

```sh
homekit.sh set "studio orb" color green           # names, #00ff00, "120,100" (hue,sat)
homekit.sh set "studio orb" color "warm white"    # or kelvin 2700 / kelvin cool
homekit.sh set "desk lamp" brightness 40
homekit.sh set "kitchen lights" color blue brightness 70   # several props at once
homekit.sh on "bedroom tv"  ·  homekit.sh off "studio lights"  ·  homekit.sh toggle fan
homekit.sh set thermostat temperature 70F mode heat        # °F/°C suffix, or the home's units
homekit.sh set "living room blinds" position 30            # also: open / close
homekit.sh set "bedroom tv" input "Apple TV" volume 20
homekit.sh set purifier mode auto speed 60
homekit.sh set dishwasher mode Eco  ·  homekit.sh start dishwasher
homekit.sh start vacuum  ·  homekit.sh dock vacuum  ·  pause / resume / stop
homekit.sh lock "front door"  ·  homekit.sh unlock "front door"   # only when the user asked
homekit.sh scene "Good Night"  ·  homekit.sh scenes
homekit.sh set lamp "Swing Mode" 1          # any HAP characteristic by its name
```

Friendly properties: `on`, `brightness`, `color`, `hue`, `saturation`, `kelvin`,
`temperature`, `heat`, `cool`, `mode`, `lock`, `open`/`close`, `position`, `tilt`,
`speed`, `swing`, `direction`, `volume`, `mute`, `input`, `key` (TV remote),
`humidity`, `arm` (security), `duration`, `childlock`, `identify`, `action`
(start/stop/pause/resume/dock). If a property isn't supported, the error lists what
the accessory *does* support.

A color or brightness change on a light that's off also turns it on, as the Home app does.

## Reading values

```sh
homekit.sh get "studio orb"            # summary + every derived value
homekit.sh get "studio orb" hex        # just one: hex, rgb, hue, saturation, kelvin,
                                    #   brightness, temperature, humidity, lock, mode…
homekit.sh get "studio orb" --json     # full services/characteristics + Matter clusters
```

`hex` is the full-brightness color and `hexAtBrightness` is scaled by brightness.
`kelvin` is only reported while the light is in white mode (`colorMode`).

## Cameras

```sh
homekit.sh cameras                                       # list
homekit.sh camera snapshot "driveway camera" --copy      # still → file, and onto the clipboard
homekit.sh camera snapshot "driveway camera" --out ~/Desktop/driveway.jpg
homekit.sh camera open "driveway camera"              # live view in a window on the Mac
homekit.sh camera url "driveway camera"                  # local MJPEG + JPEG URLs
```

**There is no RTSP URL for a HomeKit camera.** HomeKit streams are encrypted SRTP
sessions that only Apple's `homed` can open. If the user asks for RTSP, explain that
and offer the `camera url` MJPEG re-stream instead (VLC, ffplay, OBS and browsers play
it). It's 127.0.0.1-only unless the relay is on, in which case it also prints
network URLs with `?token=` for other devices. The camera's own manufacturer app may expose real RTSP.
A snapshot from an unreachable camera comes back `stale` with `capturedAt`; say so.

## Other machines (Windows, Linux, WSL): the relay

The bridge only runs on a Mac. To reach the home from elsewhere, the Mac runs
`homekit.sh relay on`, which prints a URL and token. **Turning the relay on exposes the
home to the network, so only do it when the user asks.** Then:

- Linux / WSL / Git Bash / another Mac: `homekit.sh connect <url> <token>`. Every
  command above then works unchanged. `homekit.sh bridge status` shows `via <url>`
  when you're in remote mode.
- Windows PowerShell: `clients/HomeKit.ps1` takes the same commands
  (`.\HomeKit.ps1 connect <url> <token>`, `.\HomeKit.ps1 set "studio orb" color green`,
  `-Json`).
- Anything with HTTP: `curl -H "Authorization: Bearer $TOKEN" <url>/api/accessories/studio%20orb/hex`,
  `POST <url>/api/accessories/<name>` with `{"color":"green"}`, or `POST <url>/api` with
  any raw request (`{"action":"set","target":…,"props":{…}}`).
- People: the dashboard at `<url>/?token=<token>` in any browser.

Never paste the token into chats, commits or logs beyond what the user asked for.
`homekit.sh relay rotate` replaces it.

## Matter, raw

For anything the friendly verbs don't cover:

```sh
homekit.sh matter "dishwasher"                                   # endpoints, clusters, attributes, commands
homekit.sh matter "dishwasher" invoke "Operational State" Start
homekit.sh matter "oven" invoke 0x56 0 '{"0": 18000}'            # fields keyed by tag
homekit.sh matter "fan" write "Fan Control" "Percent Setting" 40
```

## Safety

- Locks, garage doors, gates, security systems, valves and ovens act on the physical
  world. Change them only when the user explicitly asked for that accessory in this
  conversation, and never as a side effect of a group command.
- Group commands ("all lights") are fine for lights and switches the user named.
- Don't flip things just to test. Use `get`, `find` and `ls` to look around.

## When it fails

- Exit 3 / "the bridge isn't running": `homekit.sh bridge start` (it auto-starts by default).
  If that fails: `~/Desktop/HomeKit.sh/bridge/build.sh --install`.
- Exit 3 in remote mode: the relay is off or the token changed. Ask the user to run
  `homekit.sh relay status` on the Mac and reconnect.
- "no response": the accessory is offline in Home. Report it; retrying won't help.
- Wrong home: `homekit.sh homes`, then `--home "<name>"` or `homekit.sh use "<name>"`.
- Pass `--json` for machine-readable output on any command.

“Make the studio orb green when this is all done.”

With the skill, your agent finishes the build first, then turns the light green if it passed or red if it failed.

Talk to your home like a person.

Name things the way you would out loud: "studio orb", "kitchen lights", "all fans". Every command waits for HomeKit to answer before it exits.

Lights

homekit.sh set "studio orb" color green
homekit.sh set "desk lamp" brightness 40
homekit.sh set "kitchen lights" kelvin 2700
homekit.sh off "studio lights"

Climate

homekit.sh set thermostat temperature 70F mode heat
homekit.sh set purifier mode auto speed 60
homekit.sh set "living room blinds" position 30

Appliances

homekit.sh set dishwasher mode Eco
homekit.sh start dishwasher
homekit.sh dock vacuum
homekit.sh matter oven invoke 0x56 0 '{"0": 18000}'

Cameras

homekit.sh camera snapshot driveway --copy
homekit.sh camera open driveway
homekit.sh camera url driveway

Reading

homekit.sh get "studio orb"
homekit.sh get "studio orb" hex
homekit.sh find "bedroom"
homekit.sh ls --json

Scenes and live events

homekit.sh scenes
homekit.sh scene "Good Night"
homekit.sh log          # follow every change
homekit.sh              # interactive dashboard
Exit codeMeans
0Done. HomeKit confirmed the change.
1Failed. The message says why, like an accessory that isn’t responding.
2Ambiguous or not found. The candidates are listed, like Studio › Orb and Kitchen › Orb.
3The bridge or relay can’t be reached.

Windows, Linux, Android. Covered.

The bridge only runs on a Mac, but its relay shares your home with every other device on your network. There’s a web dashboard, a JSON API, and the same CLI in remote mode. It’s off until you turn it on.

homekit.sh relay on               # prints the URL, the token and a QR code
homekit.sh relay on --read-only   # look, but don't touch
homekit.sh relay rotate           # new token, disconnects every client
homekit.sh relay off
FromHow
Any browserOpen http://<mac>:8686/?token=<token> once for the dashboard: rooms, scenes, color, thermostats, cameras and live updates.
Linux, WSL, Git Bashhomekit.sh connect <url> <token>, then every command works unchanged.
Windows PowerShell.\HomeKit.ps1 connect <url> <token>, then the same commands.
Scripts, Home Assistant, Node-REDThe HTTP API with Authorization: Bearer <token>.

HTTP API

GET /api/accessoriesEvery accessory with its state and what it can do. Add ?values=1 for hex, kelvin and temperatures.
GET /api/accessories/<name>/<field>One value, like /api/accessories/studio%20orb/hex.
POST /api/accessories/<name>Set properties: {"color":"green","brightness":40}.
POST /api/accessories/<name>/<verb>on off toggle lock unlock open close start stop pause resume dock
GET /api/scenes · POST /api/scenes/<name>List and run scenes.
GET /api/cameras/<name>/snapshotA fresh JPEG. /camera/<id>.mjpg is a live MJPEG stream for VLC and OBS.
GET /api/eventsServer-Sent Events for every change, live.
GET /api/matter/<name>Raw Matter endpoints, clusters, attributes and commands.
curl -H "Authorization: Bearer $TOKEN" \
  -d '{"color":"green"}' http://mac.local:8686/api/accessories/studio%20orb

Careful by design.

Physical things need a clear ask.

The skill tells agents to change locks, garage doors, security systems, valves and ovens only when you name them, and never as part of a group command.

The relay is off by default.

Until you turn it on, the bridge only listens on this Mac. Other machines need a random 192-bit token, and repeated wrong guesses get locked out.

Read-only when you want it.

relay on --read-only lets other devices look without changing anything. Relay settings can only change on the Mac itself.

Plain HTTP on your network.

Use the relay on networks you trust, or over Tailscale or WireGuard. Put it behind an HTTPS proxy before you expose it to the internet.