[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-117424":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":15,"stars7d":15,"stars30d":15,"stars90d":15,"forks30d":15,"starsTrendScore":15,"compositeScore":16,"rankGlobal":10,"rankLanguage":10,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":18,"hasPages":18,"topics":20,"createdAt":10,"pushedAt":21,"updatedAt":22,"readmeContent":23,"aiSummary":10,"trendingCount":15,"starSnapshotCount":15,"syncStatus":24,"lastSyncTime":25,"discoverSource":26},117424,"ghosthand","ghosthand-dev\u002Fghosthand","ghosthand-dev","Control a real iPhone from AI agents over USB and Bluetooth","https:\u002F\u002Fghosthand.dev",null,"TypeScript",51,4,1,0,42.1,"Other",false,"main",[],"2026-11-10 15:26:48","2026-11-21 12:39:26","\u003Cdiv align='center' class='hidden'>\n    \u003Cbr\u002F>\n    \u003Cbr\u002F>\n    \u003Ch3>ghosthand\u003C\u002Fh3>\n    \u003Cp>Control real iPhones from a Mac with AI agents\u003C\u002Fp>\n    \u003Cbr\u002F>\n    \u003Cbr\u002F>\n\u003C\u002Fdiv>\n\nControl real iPhones from a Mac. **Screenshots over USB, taps over Bluetooth.** No jailbreak, no Xcode, no app on the phone.\n\n**The Mac becomes a Bluetooth mouse and keyboard for the iPhone.** An agent reads the screen, then points, clicks, scrolls and types like a person at a desk. So it can use **any iOS app**, including App Store apps, system apps, Settings and the lock screen.\n\n**\"upload this video to tiktok\"**. The agent opens TikTok, picks the clip from Photos, writes the caption and posts it.\n\n\u003Cvideo src='\u002Fassets\u002Fdemo-tiktok-upload.mp4' poster='\u002Fassets\u002Fdemo-tiktok-upload.jpg' preload='none' controls muted playsInline width='100%'>\u003C\u002Fvideo>\n\n**\"scroll tiktok and interact with funny videos\"**. The agent watches the feed, skips what is not funny, likes and comments on the rest.\n\n\u003Cvideo src='\u002Fassets\u002Fdemo-tiktok-warmup.mp4' poster='\u002Fassets\u002Fdemo-tiktok-warmup.jpg' preload='none' controls muted playsInline width='100%'>\u003C\u002Fvideo>\n\n> [!IMPORTANT]\n> **Requires a Mac and a real iPhone.** The CLI runs only on macOS, and the iPhone must be connected over USB and paired over Bluetooth. Linux, Windows and the iOS Simulator are not supported.\n\n```bash\nnpx ghosthand setup                           # first: sign in, connect and pair the iPhone\nnpx ghosthand list\nnpx ghosthand screenshot -o home.png          # 414x896 on an iPhone XR: screen points\nnpx ghosthand tap 207 448                     # same coordinates as the screenshot\nnpx ghosthand scroll down 5                   # mouse wheel, ~100 points per tick\nnpx ghosthand tap --text \"Settings\"           # OCR finds the text, taps its center\nnpx ghosthand type \"hello\" --enter\nsecret-provider | npx ghosthand type --stdin  # secrets stay out of argv\nnpx ghosthand key home                        # Home Screen, not Back\nnpx ghosthand tap 207 448 --screenshot s.png --screentext\nnpx ghosthand screentext --language it-IT\nnpx ghosthand record start demo.mov           # screen + sound; keep acting meanwhile\nnpx ghosthand record stop\n```\n\n\u003Cpicture>\n  \u003Csource media=\"(prefers-color-scheme: dark)\" srcset=\"https:\u002F\u002Fghosthand.dev\u002Fassets\u002Fdiagram-architecture-dark.png\" \u002F>\n  \u003Cimg alt=\"Architecture: coding agents call the ghosthand CLI over HTTP, MCP clients go through the ghosthand.dev hub and a tunnel. Both reach the Controller in the daemon (leases, OCR, state.db), which taps and types through the Bluetooth driver, reads the screen through USB capture, and uses USB lockdown for files, photos and apps. XCTest driver is optional.\" src=\"https:\u002F\u002Fghosthand.dev\u002Fassets\u002Fdiagram-architecture.png\" \u002F>\n\u003C\u002Fpicture>\n\n## Features\n\n- **Any iOS app.** Input goes through AssistiveTouch, like a real mouse. Nothing runs on the iPhone, no app and no test runner.\n- **Tap, double and triple tap, hold, swipe and hold-drag** with the mouse pointer, at screenshot coordinates or on OCR text (`tap --text`, `hold --text`).\n- **Scroll** with the mouse wheel, also in lists that a drag cannot scroll.\n- **Type text fast.** `type` sends text as key presses. `key` sends Home, Enter, Esc, arrows and volume keys.\n- **Screenshots** over USB, PNG or JPEG, about 0.3 s each. The capture stops 1 s after the last frame, so an idle daemon uses no CPU for it.\n- **Record the screen with sound.** `record start` and `record stop` write H.264 and AAC. Actions and screenshots keep working during the recording.\n- **Screen points by default.** Screenshots, OCR boxes and taps share one small coordinate space, sized for LLM vision.\n- **Read screen text** with on-device OCR (Vision). The boxes are in screenshot coordinates.\n- **Unlock** a locked iPhone with its passcode, with no touch. `list` shows the lock state.\n- **Lock** with the Bluetooth keyboard. The daemon checks the result over USB.\n- **Mute and unmute** all iPhone sound. The daemon confirms the change from the iPhone log.\n- **Files, photos and apps over USB.** Pull screenshots and photos, push files, list and uninstall apps, and read battery, storage and the system log. No Developer Mode.\n- **Several iPhones at once**, each controlled on its own.\n- **CLI, remote MCP server and skill** for agents, with the same help text.\n- **Leases** give one agent one iPhone at a time. Other agents wait or get a \"leased by\" error.\n- **HTTP API** described by OpenAPI, for any language.\n- **Every Mac of your account** through one MCP URL, or from your own scripts with the HTTP API and an API token.\n\n## Install\n\nGhosthand needs **macOS 14 or later** on Apple silicon or Intel. The npm package ships the signed Ghosthand.app with one universal binary. No Node code runs at runtime. The Bluetooth Classic private API is tested on macOS 26.3 only.\n\n**No terminal?** Download the installer from [ghosthand.dev\u002Fdownload](https:\u002F\u002Fghosthand.dev\u002Fdownload). It installs Ghosthand for your user, with no admin password, and opens the setup window. People who use ghosthand from a chat app like Claude, ChatGPT or Grok through the [remote MCP](#mcp-server) start here. The MCP sends them this link when their account has no Mac yet.\n\n```bash\nnpx ghosthand setup       # run without installing\nbunx ghosthand setup      # same, with Bun\nnpm install -g ghosthand  # install the `ghosthand` command\n```\n\n**Start with `ghosthand setup`.** It opens the Ghosthand app and starts the daemon. The app walks you through sign-in, permissions, USB trust and Bluetooth pairing. When the iPhone is ready, `list`, `screenshot`, `tap` and the other commands work.\n\n```diagram\nnpx ghosthand setup ──> Ghosthand app + daemon ──> sign in, allow access, plug in, pair\n                                                        │\nghosthand list \u002F screenshot \u002F tap \u002F type \u003C──────────────┘ iPhone ready\n```\n\n**Sign in once per Mac.** Every lease needs a ghosthand.dev account. It is **free for one iPhone, and $99\u002Fmonth per Mac for unlimited iPhones** ([pricing](https:\u002F\u002Fghosthand.dev\u002Fdocs\u002Fpricing)). `ghosthand setup` starts with **Sign in with Google**. It opens the browser, you approve the Mac, and the window continues by itself. Agents never sign in for you. They open setup and wait.\n\n```bash\nghosthand account   # who is signed in, the plan, the subscribe link\nghosthand account login     # for people without the setup window; agents use setup\nghosthand account logout\n```\n\n**You give the permissions, not the agent.** Run `ghosthand setup`, then click **Allow Camera** and **Allow Bluetooth**. macOS asks for access for Ghosthand, not for your terminal or editor. Other commands never show permission dialogs or open System Settings.\n\n```bash\nghosthand setup  # open the app, then let the user click its permission buttons\n```\n\n## Setup (once per iPhone)\n\n**You do two connection steps by hand, USB trust and Bluetooth pairing.** AssistiveTouch and keep-awake are automatic. Screenshots work after you plug in, trust and unlock the iPhone.\n\n\u003Cvideo src='\u002Fassets\u002Fsetup.mp4' poster='\u002Fassets\u002Fsetup-poster.jpg' preload='none' controls muted playsInline width='100%'>\u003C\u002Fvideo>\n\n**Setup starts with sign-in, then permissions.** `ghosthand setup` shows Sign in with Google, then the Camera and Bluetooth buttons, then the phone steps (plug in, trust, unlock, pair). If access was denied, an **Open Settings** button shows instead. The window updates by itself and ends with a \"Copy prompt for agent\" button. The command detaches at once, so the terminal stays free.\n\n**Agents wait for the user.** Open setup once and tell the user to complete setup in the small Ghosthand window. Only the user acts in the Ghosthand window. Agents must not click in it or complete setup for the user. Poll `ghosthand setup status` every 2 seconds, and continue when `ready` is `true`. While you wait, do not reopen setup, request permissions or retry input. If setup is still incomplete after 10 minutes, report the current status. To review access that is already allowed, use `ghosthand setup --permissions`.\n\n```bash\nghosthand setup status                     # JSON, works before permissions or USB trust\nghosthand setup status --device \"iPhone XR\" # select the intended phone when several exist\n```\n\n**Each phone is ready on its own.** A phone is ready when the Mac is signed in, Camera access is allowed, USB capture works, the phone is unlocked and Bluetooth is connected. After a poll selects a phone, pass its returned `device` ID on later polls. When it is ready, acquire that phone with its `captureId` from `overview` (the ID that `list` shows). The MCP tools are `setup` and `setup-status`. Neither status check needs a lease.\n\n### 1. Plug in and trust\n\nConnect the iPhone over USB, unlock it, and tap **Trust**. Then check:\n\n```bash\nghosthand list\n```\n\n### 2. Pair the Mac as a mouse and keyboard\n\nRun any input command. The daemon makes the Mac discoverable and prints the steps:\n\n```bash\nghosthand key home\n```\n\nOn the iPhone, open **Settings > Bluetooth**, tap the Mac's name (for example \"MacBook Pro\") under Other Devices, then **Pair**.\n\n- The Mac is discoverable only while a command waits for pairing.\n- **The Mac is not listed?** Turn Bluetooth off and on again on the iPhone.\n- After you tap Pair, the iPhone opens the connection, and the command continues by itself.\n- Later runs reconnect the paired iPhone from the Mac in about 2 s.\n- **The link lasts only while the iPhone is on USB.** While the link is up, iOS hides its onscreen keyboard. To type on the iPhone yourself, unplug the cable. Plug it back in and the link comes back within a few seconds, without pairing.\n- **After a report map change**, forget the Mac on the iPhone and pair again. The iPhone keeps the map it read at pairing.\n- **Pairing fails, or the Mac is gone from the list?** Forget on both sides, then pair again. See [Pairing no longer works](#pairing-no-longer-works-forget-on-both-sides).\n\n### 3. AssistiveTouch (automatic)\n\niOS accepts a mouse only through AssistiveTouch. With AssistiveTouch off, the iPhone shows no pointer and ignores every click (tested). **`acquire` turns it on over USB when it is off, and `release` turns it off again**, so a personal iPhone goes back to how it was when the agent is done. This needs no touch on the phone and works while the phone is locked:\n\n```bash\nghosthand acquire --reason \"reply to Anna\"  # AssistiveTouch on\nghosthand release -l 42                     # lease released; AssistiveTouch turned off\nghosthand assistivetouch -l 42 on           # on for good: release leaves it on\n```\n\n- **`release` turns off only what ghosthand turned on.** If AssistiveTouch was on before `acquire`, for example for a broken Home button, `release` leaves it on.\n- **`assistivetouch on|off` sets the iPhone's own setting**, so `release` leaves it as set.\n- **Expired leases count too.** When a lease ends by its idle timeout, the daemon turns AssistiveTouch off a few seconds later.\n- **Tap, swipe and wake check it again**, in case a person turned it off during the task.\n\n`state.db` keeps this state in `phone.assistive_touch_off_after_lease`.\n\nThe check is a USB lockdown read of `AssistiveTouchEnabledByiTunes` in `com.apple.Accessibility`. A read takes about 35 ms and a write about 40 ms.\n\n**Hide the floating button (recommended).** Open **Settings > Accessibility > Touch > AssistiveTouch** and turn **Always Show Menu** off (Italian: \"Mostra sempre menu\"). AssistiveTouch stays on and the pointer still works, but the round menu button no longer covers the screen. When it shows, the button sits over other buttons (in tests it covered the Messages send arrow) and fades in and out, which adds noise to screenshots and [recordings](#record-the-screen). `key home` does not need the menu (see below):\n\n```diagram\nAlways Show Menu ON   ──> round button on screen ──> in screenshots and videos\nAlways Show Menu OFF  ──> hidden while the Mac mouse is connected; taps still work\n```\n\n- **Set it on the iPhone, once.** USB lockdown has a key to turn AssistiveTouch on and off (`AssistiveTouchEnabledByiTunes`), but no key for this switch. So ghosthand cannot change it over USB. An agent can change it with taps in Settings (tested on an XR, iOS 18.7).\n- **It stays off** when `acquire` and `release` turn AssistiveTouch on and off.\n- **Apple Pay needs it on.** Paying without Face ID uses the AssistiveTouch menu, so it needs Always Show Menu on and two more settings. See [Pay with Apple Pay](https:\u002F\u002Fgithub.com\u002Fghosthand-dev\u002Fghosthand\u002Fblob\u002Fmain\u002Fdocs\u002Fsystem-dialogs.md#pay-with-apple-pay).\n\n**Home needs no setup.** `key home` sends the keyboard Home key (HID consumer Menu). It works with AssistiveTouch on or off (6 of 6 tries on an SE2 with iOS 18.6 and 26.5, and also on iOS 15.8). `key fn+h` does the same.\n\n```bash\nghosthand key home  # Home Screen\n```\n\n### 4. Keep awake (automatic)\n\n**Leave Auto-Lock as it is.** The daemon keeps every unlocked iPhone awake that is connected over both USB and Bluetooth, leased or not. So the iPhone is ready for the next command:\n\n```diagram\ndaemon, every 2 s ──> unlocked and idle for 10 s? ──yes──> Left Control press (Bluetooth)\n                            │                                    │\n                            └─ locked or command running: skip   └─> iOS resets the Auto-Lock timer\n```\n\n- **No visible effect.** A Control key press alone types nothing and shows no pointer, so screenshots stay clean. It works with AssistiveTouch off.\n- **Never in the middle of input.** A tap or typed text holds the Bluetooth link, and the key waits for it to finish.\n- **Locked iPhones are skipped.** The lock state comes from USB lockdown. A key press would light the Lock Screen (seen on iOS 18), so a locked iPhone gets no key and its display turns off normally.\n- **To let the iPhone lock by itself**, unplug USB or stop the daemon (`ghosthand daemon stop`). Keep-awake stops on the next check, within 2 seconds.\n- **To turn keep-awake off**, run `defaults write com.remorses.ghosthand KeepAwake -bool false` and set Auto-Lock to Never. Do this, for example, if you use Switch Control with a keyboard switch, because the key counts as a switch press. The change applies on the next check, with no restart.\n\nTested on an iPhone XR with iOS 18.7 and Auto-Lock at 30 seconds. Without the key, SpringBoard dims the screen at 20 s. With the key, the screen did not dim for 75 s, with and without AssistiveTouch.\n\n## Use it with an agent\n\n**Install the skill** so your agent knows the commands, the lease rules and the feedback loop:\n\n```bash\nnpx -y skills add https:\u002F\u002Fghosthand.dev -g -y\n```\n\nThis works with Claude Code, Cursor, OpenCode, Codex and other agents that read [skills](https:\u002F\u002Fskills.sh). The skill tells the agent to read `ghosthand --help` first. The help text is the full agent manual.\n\n**Agent without a shell?** Add `https:\u002F\u002Fghosthand.dev\u002Fmcp` as a remote [MCP server](#mcp-server). It has the same commands as tools.\n\n**Then ask in plain words**, with the iPhone plugged in and unlocked:\n\n```text\nUse ghosthand to open Messages on my iPhone and reply \"on my way\" to Anna.\n```\n\nThe agent takes a lease, works in a loop (read the screen, act, read the result), and releases the phone when it is done:\n\n```bash\nghosthand screentext\nghosthand tap --text \"Anna\" --screenshot s.png --screentext\nghosthand type \"on my way\" --enter --screentext\n```\n\nSee [Agent feedback loop](#agent-feedback-loop) for the rules the agent follows.\n\n**Double tap** selects words and zooms content in apps that support it. It sends two\nmouse clicks at one position, not a VoiceOver gesture or a side-button confirmation.\nEach press lasts 220...260 ms, and the gap between a release and the next press is\n100...150 ms. Single taps use the same press duration. [Apple's text-selection guide](https:\u002F\u002Fsupport.apple.com\u002Fguide\u002Fiphone\u002Fselect-cut-copy-and-paste-text-iph1a9cae52c\u002Fios)\ndescribes double-tap word selection.\n\n```bash\nghosthand double-tap -l 42 120 300 --screenshot after.png\nghosthand double-tap -l 42 --text \"example\" --screentext\n```\n\nThe same action is the MCP tool `double-tap` and HTTP route\n`POST \u002Fv1\u002Fleases\u002F{lease}\u002Fdouble-tap`, with the same arguments as `tap`. `triple-tap`\nsends three clicks with the same timing, to select a paragraph.\n\n**Hold** is a long press. The button goes down, stays still for `--duration` (default\n1000 ms), then goes up. It opens context menus, Home Screen icon menus and previews.\nThe daemon sends no reports during the hold. iOS reads repeated reports as movement,\nand a Home Screen long press then turns into edit mode.\n\n```bash\nghosthand hold -l 42 144 324 --screentext          # Notes icon: its menu with Remove App\nghosthand hold -l 42 --text \"Safari\" --duration 1500\nghosthand key -l 42 esc                             # close the menu\n```\n\n**Hold-drag** presses, stays still for `--hold` (default 1000 ms), then drags to the\ntarget over `--duration` (default 1000 ms) and releases. A plain `swipe` moves at once,\nso items that need a long press first stay in place.\n\n```bash\nghosthand hold-drag -l 42 144 324 57 412 --hold 2500   # move a Home Screen icon\nghosthand key -l 42 home                                # leave edit mode\n```\n\n> [!IMPORTANT]\n> **Home Screen icons need `--hold 2500`** from the normal Home Screen. iOS enters edit mode during the hold, then the icon follows the drag. Start on the icon, not on the AssistiveTouch button. Tested on an SE2 with iOS 18.6 and Perform Touch Gestures on.\n\nThe MCP tools are `triple-tap`, `hold` (`durationMs`) and `hold-drag` (`holdMs`,\n`durationMs`). The HTTP routes are `POST \u002Fv1\u002Fleases\u002F{lease}\u002Ftriple-tap`, `\u002Fhold` and `\u002Fhold-drag`.\n\n## Control plane: watch your agents\n\n**Many agents, many iPhones?** `ghosthand dashboard` opens a window that shows what each one is doing, on every Mac of your account:\n\n![ghosthand control plane: iPhones on two Macs in the sidebar, the live screen of the selected iPhone, the agent that holds it and its task, and the agent chat](https:\u002F\u002Fghosthand.dev\u002Fassets\u002Fcontrol-plane-fleet.jpg)\n\n- **The sidebar** lists each iPhone with a status dot: blue in use, green free, orange locked, yellow connecting, red needs setup. A badge counts the agents that wait for it.\n- **Lease details** show the agent label, the task, the lease age, the last command, the idle timeout, and the agents that run `ghosthand wait`.\n- **The screen** is small and live at up to 30 fps while the window is visible. It gets no frames when the window is hidden or covered. It needs no lease and does not reset the agent's idle timer.\n- **Connection details** show USB, Bluetooth, pointer mode, AssistiveTouch, and the device ID to copy for `acquire -d`.\n- **Take Control** starts when you hover the screen and click it. Then a click on the screen taps the iPhone there, and a drag swipes with the same start, end and duration. The Mac keyboard types into the iPhone, shortcuts like ⌘A included, and ⌘V types the Mac clipboard as text. To stop, press Esc or click **Release Control** under the screen. It needs no lease, so it also works while an agent holds the iPhone, and your input goes between the agent's commands. In Bluetooth mode a tap or swipe turns AssistiveTouch on. Release Control turns it off again if no lease holds the iPhone. If the app crashes, it turns off 60 s after your last input. ⌘Space and ⌘Tab stay on the Mac unless you allow Ghosthand in System Settings > Privacy & Security > Accessibility.\n- **Agent chat** is the right column. Type a task, and an agent on ghosthand.dev does it on the selected iPhone. It is the same agent as `ghosthand task`. Each prompt takes a lease and releases it when the agent is done. A new prompt stops the running one.\n\n![Agent chat in the control plane: each tool call is one line, the agent's answer shows when it is done](https:\u002F\u002Fghosthand.dev\u002Fassets\u002Fcontrol-plane-chat.jpg)\n\n`dashboard` and `setup` share one process. Running either command again brings its window to the front. Both read `GET \u002Fv1\u002Fphones` (see [HTTP API](#http-api)).\n\n## Agent feedback loop\n\n**The slow part is each tool call, not the phone.** So an action returns the new screen in the same call. `--screenshot` saves it and `--screentext` prints its text. Each step takes one call instead of three.\n\n```diagram\n      ┌─────────────────────────────────────────────────────────────────┐\n      v                                                                 │\n 1. see the screen           screentext (text + boxes, no image)        │\n                             or screenshot -o s.png (~500 tokens)       │\n 2. act, and see the result  tap \u002F swipe \u002F key \u002F type                   │\n                             + --screenshot s.png --screentext          │\n 3. read the printed text, and s.png if the text is not enough          │\n 4. decide the next action toward the user's task  ─────────────────────┘\n```\n\n```bash\nexport GHOSTHAND_LANGUAGE=it-IT                        # phone language for OCR, same as --language\nghosthand list\nghosthand screentext\nghosthand tap --text \"Tommaso De Rossi\" --screenshot s.png --screentext\nghosthand tap 200 610 --screenshot s.png --screentext  # x,y read from s.png\nghosthand type \"ciao\" --enter --screentext\n```\n\n**Set the OCR language once** for a non-English phone. `GHOSTHAND_LANGUAGE=it-IT` (a BCP 47 tag) applies to `screentext`, `--screentext` and `tap --text`, and `--language` overrides it. English is always included. Without the phone language, OCR misreads accents and local words.\n\n- **Text first, image when needed.** `--screentext` output is cheap and often enough to decide, for example a new title or a sent message. Read `s.png` for icons, layout, or text that OCR misses.\n- **Both flags use one frame.** The daemon runs them after the input, under the same lease, and waits for a still screen (up to 2 s after frames start). OCR reads the native frame, where small text reads better, and the image is resized from that same frame. A blank or unchanged image is not proof that input failed.\n- **Check focus before you type.** `type` sends keys to the field that has focus, and the command does not show which field that is. Read a screenshot first and check that the cursor is in the field you want. In Messages, Enter in the **To:** field adds the recipient but keeps focus there, so `type \"ciao\" --enter` put \"ciao\" into To: (tested on iOS 18.7). Tap the message field, check the screenshot, then type.\n\n  ```bash\n  ghosthand type \"5551234567\" --enter         # To: field, adds the recipient\n  ghosthand tap 200 562 --screenshot s.png    # check focus in the image\n  ghosthand type \"ciao\" --enter --screentext  # Enter sends\n  ```\n\n- **Tap text, not pixels.** `tap --text \"...\"` saves a screenshot read and a coordinate guess. On the Home Screen, app **labels do not open apps** (tested on iOS 15). Tap the icon, about 40 points above the label.\n- **Do not script wait loops.** Do not write loops that wait for a text you guess, like \"Open\" or \"Done\". The next screen is hard to predict, because iOS shows sheets and alerts at any time. For example, the App Store asks to confirm **Install**, then can say \"requires iOS 16 or later\". A loop that waits for one word then waits forever, as happened while installing Reddit on the 6s. Use a loop only when a skill or document you follow asks for it. Otherwise use the plain feedback loop: do one action, read the whole screen, and decide the next action.\n- **Capture failed after an action?** The error says **Input sent**. Do not repeat the action blindly. Take a screenshot first.\n- **No frames?** `screenshot` and `screentext` reject a locked iPhone at once. If `list` reports the iPhone unlocked but capture still gets no frame, see [USB screen capture stops](#usb-screen-capture-stops-ios-bug-restart-the-daemon-then-the-iphone).\n\n**Screen shrunk to the bottom half? That is iOS Reachability, not a hidden dialog.** The app and its sheets slide down, the top half is empty, and a sheet can look stale or dimmed. A tap in the empty top area restores the full screen (tested on an XR with iOS 18.7, `tap 207 100`). When a screen looks wrong, check for Reachability first. A secure field can also make the screen look stale. Tap outside the field and read again.\n\n```bash\nghosthand tap 207 100 --screenshot s.png --screentext   # empty top area: full screen returns\n```\n\n**Some iOS dialogs are invisible to USB capture and OCR.** On an XR with iOS 18.7, these were the App Store location prompt, the Install sheet and the cellular-data prompt. The page behind looks dimmed or unchanged, and `screentext` shows no dialog. Take a `screenshot`, read the image, and tap by position. Enter, Esc, Space, Tab and a center tap did not dismiss the location prompt, and a person had to tap **Don't Allow**. Apple documents Tab and Space for [Full Keyboard Access](https:\u002F\u002Fsupport.apple.com\u002Fen-euro\u002Fguide\u002Fiphone\u002Fipha4375873f\u002Fios), but that setting is off by default.\n\n**Screen dimmed but no dialog in the screenshot? Take a native screenshot.** USB capture leaves out some system dialogs, for example the Instagram location prompt on an SE2 with iOS 18.6. An iOS screenshot, taken with the Bluetooth keyboard shortcut, includes them. `screenshot --native` does it in one command, in about 2 s. It presses cmd+shift+3, reads the new PNG over USB, scales it to screen points (the numbers `tap` takes), then deletes it from Photos.\n\n```bash\nghosthand screenshot -l 42 --native -o real.png            # read real.png: the dialog is there\nghosthand tap -l 42 120 401 --screenshot s.png              # tap the button you read\nghosthand hold -l 42 120 401 --duration 400                 # button ignored the tap? press it once more\n```\n\nThe same steps by hand, for when you want the file:\n\n```bash\nghosthand key -l 42 cmd+shift+3                             # iOS saves a real screenshot\nghosthand photo pull -l 42 -o .                             # newest Camera Roll file, e.g. .\u002FIMG_0004.PNG\nghosthand photo delete -l 42 IMG_0004.PNG                   # remove it from Photos again\n```\n\n- The native PNG is in native pixels (750x1334 on an SE2). `screenshot --native` scales it for you. With the manual steps, pass its numbers with `tap --scale 1` (native pixels). See [Coordinates](#coordinates-screen-points).\n- **Deleting needs the optional Photos access** on the Mac. Run `ghosthand setup --permissions` once and click **Allow Photos** with the iPhone plugged in and unlocked (macOS asks about removable volumes). Without this access, the screenshot stays in Photos and the output says which file to delete.\n- **A dialog that just opened can ignore the first press.** On an SE2 (iOS 18.6, Perform Touch Gestures on), the Remove \"Notes\"? alert ignored the first press on Cancel in 8 of 8 trials and took the second. A tap, `hold --duration 400` and a stationary swipe all behaved the same. Earlier reports said that a 400 ms press works where a tap fails (location prompt, Photos Delete Photo sheet), but those were second presses too. Read the screen, then press once more.\n- **Still blocked? Try a 5-second hold at verified coordinates.** On an SE2 (iOS 26.5.2), Apple Account's **Do Not Sign Out** accepted `ghosthand hold -l 42 --text \"Do Not Sign Out\" --duration 5000` after taps and 1500...2500 ms holds failed. A native screenshot then showed Sign-In & Security. This is one success, not proof that the duration caused it. Check the result before you repeat input.\n\n**Dialog does not respond, or is invisible to capture? Try `lock`, then `unlock`** to dismiss it without accepting an option. This cleared a Maps prompt on an XR with iOS 18.7, but it may not work for every dialog. First get a user-confirmed passcode from the secret provider. If you have none, ask the user before you lock the iPhone. Try once, then check the screen. Never retry a failed passcode.\n\n```bash\nghosthand lock -l 42\nsecret-provider | ghosthand unlock -l 42 --stdin --screenshot s.png --screentext\n```\n\n**Secure password fields freeze frames** for 10 to 30 seconds. Wait, and do not type again.\n\n**Password dots are often not visible.** A screenshot of a secure field can show it empty after `type`. Do not use the dots to check the typed password, and never type it again. Submit, then check the next screen or the error.\n\n> [!IMPORTANT]\n> **Leave the iPhone unlocked.** Do not run `ghosthand lock` at the end of a task. Locking stops USB screen capture and makes the next action less reliable. Use `unlock` only when `list` shows `[locked]`.\n\n## Example: turn off the SIM PIN\n\n**The iPhone asks for the SIM PIN after every restart?** An agent can turn it off in Settings. The SIM card stores the lock, so you do it once. No USB service, MDM profile or Bluetooth protocol changes it. Only the Settings switch does, so the agent uses the UI.\n\nPut the PIN in your secret store, then ask:\n\n```text\nUse ghosthand to turn off the SIM PIN on my iPhone. The PIN is SIM_PIN in sigillo.\n```\n\n> [!CAUTION]\n> **One PIN try only.** Three wrong tries lock the SIM, and then only the carrier's PUK unlocks it. If the iPhone rejects the first PIN, or the result is unclear, the agent stops and asks the user. It never types a second PIN and never guesses `0000` or `1234`.\n\nThe agent does these steps, reading the screen after each one:\n\n```bash\nghosthand acquire --reason \"turn off SIM PIN\"                 # prints 42\nghosthand tap -l 42 --text \"Settings\" --screentext             # or tap its Home Screen icon\nghosthand tap -l 42 --text \"Cellular\" --screentext             # \"Mobile Service\" in some regions\nghosthand tap -l 42 --text \"SIM PIN\" --screenshot s.png        # dual SIM: tap the line first\nghosthand tap -l 42 340 180 --screenshot s.png                 # the switch, x,y read from s.png\nghosthand tap -l 42 60 520 --screenshot s.png                  # one keypad digit; check one new dot\n# ... one tap per digit, then check: exactly 4 dots\nghosthand tap -l 42 --text \"Done\" --screentext                 # once; the switch is now off\nghosthand release -l 42\n```\n\n- **Tap the keypad, do not type.** The SIM PIN sheet ignores the Bluetooth keyboard. `type` says \"typed\" and the field stays empty (tested on an SE2 with iOS 18.6). Tap each digit on the on-screen keypad and check that one dot appears after each tap.\n- **Tap the switch, not the label.** Read its position from the screenshot.\n- **Wrong digit?** Clear it with the keypad delete key before you tap Done. Done is the one try.\n\nTested on an XR (iOS 18.7) and an SE2 (iOS 18.6) with ho. SIMs.\n\n## CLI\n\n> [!NOTE]\n> **Every command except `list` needs a lease**, so two agents never use the same iPhone at once. `ghosthand acquire --reason \"\u003Ctask>\"` prints an ID with its Mac, like `studio:42`. Pass `-l studio:42` to every command and run `ghosthand release -l studio:42` at the end. To stay short, the examples in this README write `-l 42` or leave out `-l`. See [Leases](#leases-one-agent-per-iphone).\n\n**Grouped commands take a subcommand.** The groups are `file`, `photo`, `app`, `record`, `setup`, `account` and `daemon`, as in `ghosthand file push` and `ghosthand record stop`. `setup` and `account` also run alone. MCP tool names join the words with `-` (`file-push`).\n\n| Command                                                             | Does                                                                                                               |\n| ------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |\n| `list`                                                              | iPhones on USB, `[locked]`, their Bluetooth link state, and who leases them                                        |\n| `acquire --reason task [--force] [--idle-timeout s] [--label text]` | take the iPhone for a task; prints the lease id                                                                    |\n| `wait --reason task [--timeout s]`                                  | wait until another lease ends, then acquire; prints the lease id                                                   |\n| `release`                                                           | end the lease; turns AssistiveTouch off if `acquire` turned it on                                                  |\n| `screenshot [-o file.png\\|.jpg] [--settle] [--native]`              | save the screen; `--settle` waits until it stops changing; `--native` shows dialogs USB capture hides              |\n| `screentext [--language it-IT] [--json]`                            | OCR of the screen: `x,y wxh text` per line. English is always included                                             |\n| `tap \u003Cx> \u003Cy>`                                                       | tap at screenshot coordinates                                                                                      |\n| `tap --text \u003Ctext> [--index n]`                                     | tap the center of an OCR text line (exact line wins, else contains)                                                |\n| `double-tap \u003Cx> \u003Cy>`, `triple-tap \u003Cx> \u003Cy>`                          | two or three clicks at one point: select a word or a paragraph                                                     |\n| `hold \u003Cx> \u003Cy> [--duration ms]`                                      | long press (context menus, Home Screen icon menu); also `--text`                                                   |\n| `swipe \u003Cx1> \u003Cy1> \u003Cx2> \u003Cy2> [--duration ms]`                         | drag with the button held; content moves by the drag length (no momentum)                                          |\n| `hold-drag \u003Cx1> \u003Cy1> \u003Cx2> \u003Cy2> [--hold ms] [--duration ms]`         | long press, then drag while held: move Home Screen icons                                                           |\n| `scroll \u003Cup\\|down> \u003Cticks> [--at x,y]`                              | mouse wheel scroll, \\~100 points per tick; scrolls lists that `swipe` cannot. See [docs\u002Fscroll.md](docs\u002Fscroll.md) |\n| `key \u003Ccombo>`                                                       | `home`, `enter`, `esc`, `backspace`, arrows, `pageup`, `pagedown`, `end`, `volumeup`                               |\n| `mute` \u002F `unmute`                                                   | silence all iPhone sound, or turn it back on; confirmed from the iPhone log                                        |\n| `type \u003Ctext> \\| type --stdin [--enter]`                             | validated US-ASCII text; stdin keeps secrets out of arguments                                                      |\n| `wake`                                                              | turn the display on and check that USB frames arrive                                                               |\n| `unlock --stdin`                                                    | wake and unlock (or `GHOSTHAND_PASSCODE`); no screenshot while locked                                              |\n| `record start \u003Cfile.mov\\|.mp4> [--fps n] [--max-duration s]`        | record screen and sound to a file; stops by itself after 5 min. See [Record the screen](#record-the-screen)      |\n| `record stop`                                                       | stop the recording; prints duration, size and fps                                                                  |\n| `assistivetouch [on\\|off]`                                          | show or set AssistiveTouch over USB; `acquire` turns it on by itself                                               |\n| `lock`                                                              | lock over Bluetooth with Control-Command-Q                                                                         |\n| `rename \u003Cname>`                                                     | set the iPhone's name over USB; the id does not change                                                             |\n| `forget`                                                            | remove the Mac's Bluetooth bond with the iPhone, to pair again                                                     |\n| `random \u003Cname\\|lastname\\|username\\|birthdate\\|password>`            | random account detail, saved in state.db with the lease's task and iPhone; `random list` shows them all            |\n| `file list \u003Cpath> [--app id]`                                       | list a folder over USB: `\u002FDCIM`, `\u002FDownloads`, or an app's `\u002FDocuments`. See [Files](#files-photos-and-apps-over-usb) |\n| `file pull \u003Ciphone path> [local]` \u002F `file push \u003Clocal> \u003Ciphone path>` | copy a file or folder from or to the iPhone over USB; `--app id` for an app's Documents                           |\n| `file remove \u003Ciphone path>`                                         | remove a file or folder over USB; refuses `\u002FDCIM`                                                                  |\n| `photo list` \u002F `photo pull [--last n]`                              | newest Camera Roll files, or copy them to this Mac                                                                 |\n| `photo delete \u003Cname...>`                                            | delete photos so Photos forgets them too (ImageCaptureCore); needs Allow Photos                                   |\n| `app list` \u002F `app install \u003Cfile.ipa>` \u002F `app uninstall \u003Cid>`        | installed apps with their Home Screen page; install a signed IPA; uninstall                                        |\n| `info`                                                              | battery, storage, iOS build, serial, language, time zone, SIM; works while locked                                  |\n| `logs [--process p] [--grep text] [--seconds n]`                    | iPhone system log over USB, from now on                                                                            |\n| `restart` \u002F `shutdown`                                              | restart or turn off over USB; ask the user first                                                                   |\n| `setup`                                                             | window for people: connect a new iPhone step by step                                                               |\n| `setup status`                                                      | setup readiness as JSON: missing permissions, disconnected phones                                                  |\n| `dashboard`                                                         | window for people: every iPhone, its agent, task, last command and live screen                                     |\n| `account` \u002F `account login` \u002F `account logout`                      | this Mac's ghosthand.dev account and plan                                                                          |\n| `daemon start\\|stop\\|restart\\|status\\|run`                          | manage the background daemon                                                                                       |\n\nThe daemon starts by itself on the first command. After a rebuild, the CLI restarts it.\n\n### Secret text from stdin\n\n**Pipe secrets directly** after you check focus. The CLI validates all input before it sends any key, and does not echo rejected characters.\n\n```bash\nsecret-provider | ghosthand type --stdin\n```\n\nThe CLI removes one final **LF or CRLF** and keeps all other whitespace. LF sends Enter and Tab moves focus. `--keep-final-newline` keeps the final LF, and `--enter` adds one more Enter. Unsupported control characters, invalid UTF-8 and non-ASCII text fail before any input.\n\n### Keyboard shortcuts\n\n**The Mac is a real keyboard and mouse** for the iPhone, so iOS keyboard shortcuts work with `key`. To replace the text in a field, select all and delete it:\n\n```bash\nghosthand key -l 42 cmd+a\nghosthand key -l 42 backspace\n```\n\n**The modifiers are** `cmd`, `shift`, `alt` (option), `ctrl` and `fn` (Globe). The daemon sends `fn` as the standard Globe key of non-Apple keyboards (Consumer AC Keyboard Layout Select, `0x29D`). `key fn` alone is a Globe tap. Keys in a combo go down in order, so `tab+h` holds Tab, then presses H.\n\n| Combo | Action |\n| ----- | ------ |\n| `cmd+a` | select all |\n| `alt+backspace` | delete the previous word |\n| `cmd+backspace` | delete to start of line |\n| `shift+left` | extend the selection by one letter |\n| `cmd+left` \u002F `cmd+right` | go to start \u002F end of line |\n| `cmd+shift+left` \u002F `right` | select to start \u002F end of line |\n| `cmd+up` \u002F `cmd+down` | go to start \u002F end of the text |\n| `cmd+shift+up` \u002F `down` | select to start \u002F end of the text |\n| `cmd+c`, `cmd+v`, `cmd+z` | copy, paste, undo |\n| `tab` \u002F `shift+tab` | next \u002F previous field or focused item |\n| `space` | activate the focused item |\n| `esc` | dismiss menus, suggestions, some dialogs |\n| `cmd+l`, `cmd+f`, `cmd+r` | Safari: address bar, find on page, reload |\n| `fn+h` | Home Screen |\n| `fn+up` | App Switcher |\n| `fn+c`, `fn+n` | Control Center, Notification Center |\n| `tab+h` | show all commands (only with **Full Keyboard Access** on) |\n\nOn an iPhone SE 2 with iOS 18.6, `fn+h`, `fn+up`, `fn+c` and `fn+n` work with Full Keyboard Access off. `tab+h` shows the command list in every app (Safari, Messages, Settings, Home Screen), but only when Settings > Accessibility > Keyboards & Typing > Full Keyboard Access is on. The other combos are iPadOS shortcuts, so read the screen after each one.\n\n**iPhone paired before the `fn` fix?** Forget the Mac on the iPhone and pair again. The old report map dropped the Globe usage, because iOS read the logical max `0xB0` as -80. The new pairing also adds `scroll left|right`.\n\n### Full Keyboard Access (optional)\n\n**Full Keyboard Access** is an iOS accessibility setting that controls the whole iPhone from a keyboard, with a blue focus box instead of touch. The user turns it on in Settings > Accessibility > Keyboards & Typing > Full Keyboard Access. It is off by default, and ghosthand does not need it. Ask the user before you turn it on, because it changes the iPhone for them too.\n\n| Combo | Action | Tested |\n| ----- | ------ | ------ |\n| `tab` \u002F `shift+tab` | move focus to the next \u002F previous group | yes (the first Tab focuses the AssistiveTouch button) |\n| arrows | move focus inside a group (list rows); in a text field they move the cursor | yes |\n| `space` | activate the focused item | yes |\n| `esc`, `tab+b` | go back | yes |\n| `tab+f` | **find**: type an item's name, Enter activates it | yes in Settings; no result on the Home Screen |\n| `tab+h` | show all commands | yes |\n| `tab+m` | contextual menu (long press) | no |\n| `tab+z` | actions of the focused item, for example delete a row | no |\n| `tab+l` | lock screen | no |\n| `tab+r` | rotate device | no |\n| `tab+g` | keyboard gestures (touch, swipes, zoom, two-finger gestures) | no |\n| `tab+x` | Accessibility Shortcut | no |\n| `fn+s` | Siri | no |\n| `ctrl+tab` \u002F `ctrl+shift+tab` | next \u002F previous item | no |\n\nThe full list, with custom keys, is in Settings > Full Keyboard Access > Commands.\n\n**Tests on an iPhone SE 2 with iOS 18.6 found these limits:**\n\n- **The focus box shows in screenshots.** It is blue and can frame the whole screen. Turn on Auto-Hide to hide it after idle time.\n- **A command can do nothing.** The first `tab+f` and the first `tab+b` did nothing, and the second press worked. Check the screen after each key.\n- **Dangerous chords.** With it on, `ctrl+alt+shift+cmd+s` calls Emergency SOS and `ctrl+alt+shift+cmd+r` restarts the iPhone. Never send them.\n\n### Mute\n\n**`mute` sets a state. It does not toggle.** You can run it twice safely.\n\n```bash\nghosthand mute  # muted iPhone XR Tommy\nghosthand unmute\n```\n\nThe keyboard Mute key (consumer `0xE2`) toggles iOS **full mute**, which silences all output, including media in every app. The ringer switch does not silence app media. USB lockdown cannot read the mute state, so the daemon reads SpringBoard's log line after each press:\n\n```diagram\nMac ──BT Mute key──> SpringBoard ──FullMute──> audiomxd\n ^                       │\n └──USB syslog_relay─────┘  \"Updated fullyMuted to true\"\n```\n\nIf the phone was already in the requested state, the first press toggles it away and a second press toggles it back, with about 50 ms of sound between them. If no log line comes within 3 s, the command fails with `mute-unconfirmed` and sends no second press. Tested on an XR with iOS 18.7. Full mute stays on when screen capture starts or stops.\n\n### Record the screen\n\n**Record while an agent works.** The recording uses the same USB capture as screenshots, so input and screenshots keep working while it runs.\n\n```bash\nghosthand record start demo.mov --fps 30   # returns at once\nghosthand tap --text \"Settings\"\nghosthand record stop\n# \u002FUsers\u002Fme\u002Fdemo.mov  12.4s  2.1 MB  828x1792  30 fps  sound  stopped by request\n```\n\n```\niPhone ──USB──> capture session ──┬──> latest frame ──> screenshot, screentext, tap --text\n                                  └──> fps cap ──> AVAssetWriter (H.264 + AAC) ──> demo.mov\n                 sound output ────────────────────────────┘  (added only while recording)\n```\n\n| Rule | Detail |\n| ---- | ------ |\n| **Auto stop** | after `--max-duration` (default 300 s, max 3600), when the lease ends, or when the daemon stops. The file is complete in each case |\n| **Size** | 3-5 MB per minute on a still screen, at most about 17 MB per minute while it moves (measured on an XR) |\n| **Path** | a new `.mov` or `.mp4` on the daemon's Mac. It never overwrites a file |\n| **Sound** | the iPhone's sound output. `--no-audio` leaves it out. With sound, start and stop pause media that plays on the iPhone, so start the recording first, then press play |\n| **Clean video** | turn **Always Show Menu** off in Settings > Accessibility > Touch > AssistiveTouch, or the round AssistiveTouch button shows in the video. See [AssistiveTouch](#3-assistivetouch-automatic). iOS still draws the mouse pointer dot, so it stays in the video |\n\n### Bounded text verification\n\n**Send once, then check OCR.** `tap`, `swipe`, `scroll`, `key`, `type` and `wake` accept a text that you expect on the next screen. The match is a case-insensitive substring:\n\n```bash\nghosthand tap --text \"General\" --wait-text \"About\" --timeout-ms 5000\n```\n\nThe deadline starts **after the input completes**, not during Bluetooth pairing. The default is 5000 ms, and the range is 1...60000 ms. The daemon runs the check on the native frame, and a frame read never waits past the deadline. On a timeout, the error says that the input was sent and reports the OCR reads that completed, including unchanged text. It never repeats input. OCR cannot prove that the input caused a matching screen, especially if that text was already there.\n\nA failed check stops the command before the optional screenshot and OCR output. Read the screen in a separate command before you decide if another action is safe. Locked-phone, Bluetooth and USB errors keep their own error details. Missing frames alone do not show their cause. Never lock a phone to repair capture.\n\n**Environment variables** set a default for every command. A flag overrides them:\n\n| Variable             | Same as                                                          | Example                                            |\n| -------------------- | ---------------------------------------------------------------- | -------------------------------------------------- |\n| `GHOSTHAND_LANGUAGE` | `--language` (OCR in `screentext`, `--screentext`, `tap --text`) | `it-IT`                                            |\n| `GHOSTHAND_SCALE`    | `--scale` (image and coordinate size)                            | `1` for native pixels                              |\n| `GHOSTHAND_PASSCODE` | passcode for `unlock`                                            | user-confirmed secret; prefer `unlock --stdin`     |\n| `GHOSTHAND_LEASE`    | `-l, --lease` (every device command)                             | supported, but agents must pass `-l 42` explicitly |\n\n## Files, photos and apps over USB\n\n**These commands do not use the screen.** They use the iOS services that a trusted Mac can reach over the cable, the same ones Finder uses. They need no Developer Mode and no app on the iPhone. They work while the iPhone is locked, except photo deletes and native screenshots.\n\n```bash\nghosthand photo pull -l 42 --last 3 -o .\u002Fphotos      # newest Camera Roll files to this Mac\nghosthand file push -l 42 report.pdf \u002FDownloads\u002Freport.pdf\nghosthand app list -l 42                             # bundle ids, versions, Home Screen page\nghosthand info -l 42                                 # battery, storage, iOS build, time zone\nghosthand logs -l 42 --process appstored --seconds 10\n```\n\n```\n                         ┌── com.apple.afc ─────────────> \u002Fvar\u002Fmobile\u002FMedia (DCIM, Downloads)\nghosthand ──USB lockdown─┼── house_arrest ──────────────> an app's Documents (file sharing apps)\n (MobileDevice.framework)├── installation_proxy ────────> app list, install, uninstall\n                         ├── springboardservices ───────> Home Screen page of each app\n                         ├── diagnostics_relay ─────────> restart, shutdown\n                         └── syslog_relay ──────────────> system log\nImageCaptureCore (like Image Capture.app) ──────────────> delete photos so Photos forgets them\n```\n\n### Get photos and files from the iPhone\n\n**Photos, videos and screenshots are files under `\u002FDCIM`.** `photo list` shows the newest first, and `photo pull` copies them. `file pull` copies any path, and copies a folder as a folder.\n\n```bash\nghosthand photo list -l 42 --limit 5\n# 845 KB    2026-10-10 10:52  \u002FDCIM\u002F100APPLE\u002FIMG_0008.PNG\nghosthand file pull -l 42 \u002FDCIM\u002F100APPLE\u002FIMG_0008.PNG shot.png\nghosthand file pull -l 42 \u002FDCIM\u002F100APPLE .\u002Fcamera-roll   # whole folder\n```\n\n| Path | What is there |\n| --- | --- |\n| `\u002FDCIM\u002F100APPLE\u002FIMG_0001.PNG` | Camera Roll. Screenshots are PNG, camera photos HEIC or JPG, videos MOV |\n| `\u002FDownloads` | iOS download databases. Not the Files app's Downloads |\n| `\u002FBooks`, `\u002FPublicStaging`, `\u002FiTunes_Control` | Books, app install staging, media sync |\n| `--app \u003Cbundle id>` + `\u002FDocuments\u002F...` | an app's Documents, only for apps with **file sharing** (`[file sharing]` in `app list`) |\n\n**USB cannot reach the Files app (\"On My iPhone\") or other app data** without Developer Mode. With iCloud Photos and \"Optimize iPhone Storage\", older originals may not be on the iPhone.\n\n### Send files to the iPhone\n\n```bash\nghosthand file push -l 42 report.pdf \u002FDownloads\u002Freport.pdf\nghosthand file push -l 42 movie.mp4 \u002FDocuments\u002Fmovie.mp4 --app org.videolan.vlc-ios\nghosthand file remove -l 42 \u002FDownloads\u002Freport.pdf\n```\n\n**A pushed file is not in any app** unless you push it to an app with file sharing (`--app`). Then it shows in that app, and in Files > On My iPhone > that app when the app supports it.\n\n### Send media for uploads in apps\n\n**Apps like TikTok and Instagram upload only from Photos**, and Photos does not import a file copied to `\u002FDCIM`. **`ghosthand upload`** puts the file on ghosthand.dev and prints a short link to a page with a **Save** button. Safari's share sheet then offers **Save Video** or **Save Image**:\n\n```bash\nghosthand upload clip.mp4          # https:\u002F\u002Fghosthand.dev\u002Fu\u002F3fK9xQ2mZr7T, expires in 1 day\nghosthand key -l 42 cmd+space      # open Safari, then cmd+l, type the link, enter\nghosthand tap -l 42 --text Save    # wait until the button says Save, not Loading...\nghosthand tap -l 42 --text \"Save Video\"\n```\n\n- **It needs a signed-in account**, on any plan. It needs no lease, because the upload does not touch the iPhone.\n- **Files can be at most 2 GB.** Anyone with the link can download the file for 1 day.\n- **Offline, or a bigger file?** Use `file push` into VLC, then Files > Share > Save Video.\n\n[docs\u002Fsend-media.md](docs\u002Fsend-media.md) has the full steps and explains why there is no USB-only path. It is also at https:\u002F\u002Fghosthand.dev\u002Fdocs\u002Fsend-media.\n\n### Delete photos\n\n```bash\nghosthand photo delete -l 42 IMG_0008.PNG\n```\n\n**Never remove `\u002FDCIM` files with `file remove`.** Photos keeps a broken entry (tested on an SE2 with iOS 18.6), so `file remove` refuses `\u002FDCIM`. `photo delete` uses ImageCaptureCore, like Image Capture.app, so Photos forgets the photo too. The delete is permanent. It skips Recently Deleted, and with iCloud Photos the delete syncs. It needs the iPhone unlocked and the optional **Allow Photos** access from `ghosthand setup --permissions`.\n\n### Apps\n\n```bash\nghosthand app list -l 42\n# com.burbn.instagram  Instagram 450.1.0  (page 2)\n# com.example.beta  Beta 1.2  [installing]  (App Library only)\nghosthand app install -l 42 MyApp.ipa         # signed for this iPhone: ad hoc, enterprise, development\nghosthand app uninstall -l 42 com.example.app\n```\n\n- **The Home Screen place** is `dock`, `page N`, or `page N, folder \u003Cname>`. Swipe to that page, then tap the icon.\n- **`[installing]`** marks an App Store download that is not done. Trust it over the App Store button label, which can show Resume during the download.\n- **Opening an app over USB needs Developer Mode**, so ghosthand taps its icon instead.\n- **App Store apps install from the App Store app.** `app install` takes only IPAs signed for this iPhone.\n\n### Device info, logs, restart\n\n```bash\nghosthand info -l 42\n# battery: 100%, on power\n# storage: 51.0 GB free of 57.4 GB\n# sim tray: SIM card in\n# sim line 2: Vodafone_Ho_it, physical SIM, MCC 222 MNC 10\nghosthand logs -l 42 --process SpringBoard --grep fullyMuted --seconds 5\nghosthand restart -l 42      # ask the user first\n```\n\n**The system log has no history over USB.** Lines start when `logs` starts, so run it while the event you watch happens. **After `restart`, a person must type the passcode once.** Until then, iOS ignores the Bluetooth keyboard. After `shutdown`, a person must press the side button to turn the iPhone on.\n\n## Leases: one agent per iPhone\n\n**Every command that uses an iPhone needs a lease.** So two agents on one Mac cannot tap the same phone at the same time. `list` needs no lease.\n\n```bash\nghosthand acquire -d 7EF219AD-69B4-423E-B8C4-4F4A6140822F --label ses_123 --reason \"reply to Anna\"  # prints studio:42 (42 below)\nghosthand tap -l 42 207 448    # runs on the lease's iPhone; no -d\nghosthand release -l 42\n```\n\n```diagram\nagent A: acquire ──> lease 42 ──> tap -l 42, type -l 42 ────────> release -l 42\nagent B:       acquire ──> error: in use by \"ses_123\" for \"reply to Anna\":\n                           acquired 2m3s ago, last command 4s ago, ends after 9m56s idle\nagent B:       decides: give up \u002F tell the user, or\n               wait --reason \"...\" --timeout 600 ─────── waits ──────> lease 43\n```\n\n- **Always pass `--reason`** with the task. If the phone is busy, `acquire` fails at once. The error shows the label, its reason, when it was acquired and its last command, so the next agent can decide to give up instead of waiting.\n- **`wait` is a separate command on purpose.** An agent must read who holds the phone before it waits. `wait` retries every second, with no queue order. On timeout it shows the current label and reason.\n- **A lease ends 10 minutes after its last command** (`--idle-timeout`), so a crashed agent never blocks the phone.\n- **`--force`** takes the phone from a lease whose holder is gone. That holder's next command fails with `lease-invalid`.\n- **After `wait` or `--force`, take a screenshot first.** Someone else used the phone.\n- **Pass the ID explicitly with `-l`.** Tool-call environments may not keep variables between calls, so do not rely on an exported `GHOSTHAND_LEASE`.\n- **IDs only increase.** SQLite stores the counter, so the daemon never reuses an ID after expiry, force, release or a daemon restart. Do not delete or restore `state.db`.\n- **`--label` is only display text**, for example your agent session ID, so others can find who holds the phone. The daemon does not check it, it need not be unique, and an acquire with the same label does not resume an active lease.\n- **Lease numbers are coordination IDs, not authentication.** The tunnel needs an API token. Anyone with daemon access can acquire or force leases.\n- **Lease IDs always carry their Mac.** An iPhone on Mac `studio` gets `studio:42`, also on that Mac itself, so the ID works from every Mac of the account (see [Several Macs](#several-macs-one-list)). Only a signed-out Mac returns a plain `42`. A plain `42` also works on its own Mac.\n- Leases live in the `lease` table of `state.db`, so they survive a daemon restart, for example after a rebuild.\n\n## Coordinates: screen points\n\n**Screenshots, `screentext` boxes, `tap` and `swipe` use one coordinate space, iOS screen points.** A point is 2 native pixels on @2x iPhones and 3 on @3x ones, so an iPhone XR (828x1792) gives a 414x896 image. Plus models are the exception. They render at 1080 px for 414 points, and ghosthand knows the native size of each iPhone screen. Read a spot in the image, and send the same numbers.\n\n| iPhone       | Native pixels | Default (points) | Claude tokens | GPT tokens (32 px patches x1.2) |\n| ------------ | ------------- | ---------------- | ------------- | ------------------------------- |\n| 6s (@2x)     | 750x1334      | 375x667          | 336           | 303                             |\n| XR (@2x)     | 828x1792      | 414x896          | 480           | 437                             |\n| 14 Pro (@3x) | 1179x2556     | 393x852          | 465           | 422                             |\n\n**Points keep UI text readable**, because 17 pt body text is 17 px. A screenshot costs about a quarter of the native tokens on @2x iPhones and an eighth on @3x. It also stays under every model's resize limit, so the model sees exactly the pixels that the CLI maps back. Claude models before 4.7 shrink anything over 1568 px or 1568 tokens (28 px patches), so they would shrink an XR screen at native size to an unknown scale ([Claude vision](https:\u002F\u002Fplatform.claude.com\u002Fdocs\u002Fen\u002Fbuild-with-claude\u002Fvision#resolution-and-token-cost), [OpenAI vision](https:\u002F\u002Fplatform.openai.com\u002Fdocs\u002Fguides\u002Fimages-vision#calculating-costs)).\n\n**For other sizes**, use `--scale` (a fraction of native pixels) or `GHOSTHAND_SCALE`. Use the same value for every command, because it also changes how `tap` reads coordinates:\n\n```bash\nghosthand screenshot -o full.png --scale 1  # native pixels, 828x1792\nghosthand tap 414 896 --scale 1             # native pixel coordinates\n```\n\n`screentext` always runs OCR on native pixels, where small text reads better, then scales the boxes.\n\n## Does Ghosthand need iPhone Mirroring?\n\n**No.** Ghosthand captures the screen over USB and sends input as a Bluetooth mouse and keyboard. It does not use Apple's iPhone Mirroring app.\n\n[Apple documents these iPhone Mirroring limits](https:\u002F\u002Fsupport.apple.com\u002Fen-us\u002F120421). Ghosthand's default mode uses USB and Bluetooth, so these limits do not apply:\n\n| iPhone Mirroring | Ghosthand |\n| --- | --- |\n| Unavailable in the EU | No EU restriction |\n| iPhone must stay locked; unlocking ends mirroring | iPhone stays unlocked for screen capture and control |\n| Same Apple Account with two-factor authentication on both devices | No matching Apple Accounts needed; USB trust and Bluetooth pairing instead |\n| Only one iPhone at a time | Several iPhones per Mac; 2 tested, Bluetooth limits still apply |\n| Wi-Fi and Bluetooth must be on for both devices | Screen capture and input need USB and Bluetooth, not iPhone Wi-Fi; the Mac still needs internet for account and remote features |\n| Opening Control Center requires macOS 27 or later | `ghosthand key fn+c` opens it on the iPhone; tested on iOS 18.6 |\n| Connection automatically pauses after inactivity | The daemon keeps connected, unlocked iPhones awake; leases still expire after 10 idle minutes by default |\n\nGhosthand still needs a Mac, a USB cable and Bluetooth. See [Setup](#setup-once-per-iphone) and [Limits](#limits).\n\n## Why this instead of Appium?\n\n**Ghosthand lets an agent control your own phone without a development setup.** After you install ghosthand on the Mac, you do two connection steps by hand:\n\n1. **USB.** Connect the iPhone, unlock it, and accept **Trust This Computer**.\n2. **Bluetooth.** Pair the Mac as a mouse and keyboard from the iPhone's Settings.\n\nYou install nothing on the iPhone. You need no Xcode, Developer Mode, developer account, signing certificates or test runner. Ghosthand turns AssistiveTouch on by itself. Allow Camera and Bluetooth with the buttons in `ghosthand setup`. Keep the phone unlocked and its screen awake. See [Setup](#setup-once-per-iphone).\n\n**Appium on iOS uses WebDriverAgent (WDA)**, a signed test runner that controls the UI through Apple's XCTest framework. It can control existing App Store apps too, not only apps you develop. Its [device setup](https:\u002F\u002Fappium.github.io\u002Fappium-xcuitest-driver\u002Flatest\u002Fgetting-started\u002Fdevice-setup\u002F) requires trust, Developer Mode on recent iOS versions, and provisioning for WDA.\n\n| Tradeoff             | ghosthand                                         | Appium \u002F WDA                                                                                     |\n| -------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------ |\n| Phone setup          | USB trust + Bluetooth pairing                     | Development setup + signed runner                                                                |\n| Signing renewal      | None; no runner installed                         | Free Personal Team: renew WDA provisioning every 7 days; paid membership avoids the weekly limit |\n| Input                | Mouse, keyboard, and wheel through AssistiveTouch | Native UI-testing gestures, including multi-touch                                                |\n| Find controls        | Screenshots, OCR, coordinates                     | UI elements and attributes, plus screenshots and coordinates                                     |\n| Runtime dependencies | USB capture + Bluetooth link                      | Running WDA \u002F XCTest session                                                                     |\n| App lifecycle        | Navigate through the visible UI                   | Direct launch, terminate, and state queries                                                      |\n| Text                 | US-ASCII only                                     | Broader text support, depending on the field                                                     |\n| Fleet size           | Bluetooth limit: about 7 per Mac, 2 tested        | No Bluetooth limit; depends on host resources and USB                                            |\n\n### No developer account or weekly signing renewal\n\n**Appium does not require a paid account.** A free Xcode Personal Team can sign WDA, but Apple limits it to 3 registered devices and to provisioning profiles that expire after 7 days. After a profile expires, the runner cannot launch with it. You must rebuild, sign again and reinstall the runner with renewed provisioning. Your other apps and their accounts are not affected. See [Apple's Personal Team limits](https:\u002F\u002Fdeveloper.apple.com\u002Fhelp\u002Faccount\u002Fbasics\u002Fabout-your-developer-account).\n\n**Ghosthand has no app to sign or renew on the iPhone.** A paid [Apple Developer Program membership](https:\u002F\u002Fdeveloper.apple.com\u002Fprograms\u002Fenroll\u002F) costs US$99 per year (regional pricing varies) and removes the free team's weekly limit. But WDA certificates and profiles still need renewal when they expire.\n\n### Reliability\n\n**In my experience, the runner of an Appium-like XCTest setup crashed often.** USB capture plus Bluetooth input has been more reliable for controlling my own phone. This is personal experience, not a controlled benchmark, and not a claim that every Appium setup crashes. Without WDA there are no runner crashes, signing failures or XCTest idle waits, but other failures can still happen.\n\n**Both approaches have known issues.** Appium's [troubleshooting guide](https:\u002F\u002Fappium.github.io\u002Fappium-xcuitest-driver\u002Flatest\u002Ftroubleshooting\u002F) documents unresponsive real devices and `testmanagerd` crashes. With ghosthand, Bluetooth can disconnect, USB capture can freeze or miss system dialogs, and private macOS APIs can change. Mouse drags do not always act like finger swipes, and there is no UI element tree or multi-touch. See [Limits](#limits).\n\n**The input path is the one a real mouse-and-keyboard user has.** The iPhone receives Bluetooth HID input through AssistiveTouch, the path a person uses with physical peripherals, not an XCTest runner. So there are no runner-specific signals, and automation may be harder to tell apart from that legitimate use. We have not measured detection rates. Pointer input, screen capture and automated behavior can still give signals. Neither approach is proven to prevent bot detection or account restrictions.\n\n### Optional: XCTest mode\n\n**One iPhone can use WebDriverAgent instead of Bluetooth**, for system alerts that ignore the pointer and dialogs that USB capture hides. The commands stay the same. It needs Xcode signed in to an Apple account, and Developer Mode and UI Automation on the iPhone. It has no lock, passcode unlock, mute or keyboard shortcuts.\n\n```bash\nghosthand control -l 42 xctest      # builds WebDriverAgent once (1-3 min), then starts it\nghosthand control -l 42 bluetooth   # back to the default\n```\n\nThe setup window shows the choice for iPhones with Developer Mode on. For other iPhones, open it with `ghosthand setup --xctest`. See [docs\u002Fxctest-mode.md](docs\u002Fxctest-mode.md) ",2,"2026-11-24 04:55:39","CREATED_QUERY"]