{"id":50863666,"url":"https://github.com/dannote/pi-ios","last_synced_at":"2026-06-14T23:05:45.639Z","repository":{"id":339761935,"uuid":"1163270747","full_name":"dannote/pi-ios","owner":"dannote","description":"Pi coding agent for iOS - native Bun + Ghostty terminal","archived":false,"fork":false,"pushed_at":"2026-02-21T11:43:46.000Z","size":607,"stargazers_count":22,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-27T16:39:00.142Z","etag":null,"topics":["bun","coding-agent","ghostty","ios","metal","native","pi-agent","swift","terminal"],"latest_commit_sha":null,"homepage":null,"language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dannote.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-21T11:16:29.000Z","updated_at":"2026-04-16T04:04:26.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/dannote/pi-ios","commit_stats":null,"previous_names":["dannote/pi-ios"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dannote/pi-ios","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannote%2Fpi-ios","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannote%2Fpi-ios/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannote%2Fpi-ios/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannote%2Fpi-ios/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dannote","download_url":"https://codeload.github.com/dannote/pi-ios/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dannote%2Fpi-ios/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34340834,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bun","coding-agent","ghostty","ios","metal","native","pi-agent","swift","terminal"],"created_at":"2026-06-14T23:05:44.541Z","updated_at":"2026-06-14T23:05:45.634Z","avatar_url":"https://github.com/dannote.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pi for iOS\n\nRun the [Pi coding agent](https://github.com/mariozechner/pi-coding-agent) natively on iOS.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/screenshot.png\" width=\"300\" alt=\"Pi running on iPhone\" /\u003e\n\u003c/p\u003e\n\n## Features\n\n- **Native Performance**: Runs Bun's JavaScript engine directly on iOS using JSC's C_LOOP interpreter\n- **GPU-Accelerated Terminal**: Uses [Ghostty](https://ghostty.org)'s Metal-based terminal renderer\n- **Full Pi Agent**: Complete pi coding agent with tool use, file operations, and more\n- **Works Offline**: No WebView, no remote execution - everything runs locally on device\n\n## Requirements\n\n- iOS 17.0+\n- iPhone with arm64 processor\n- OpenRouter API key (for AI model access)\n\n## Installation\n\n### From Source\n\n1. **Clone the repository**\n   ```bash\n   git clone https://github.com/dannote/pi-ios.git\n   cd pi-ios\n   ```\n\n2. **Download pre-built dependencies**\n   \n   Download the vendor libraries from [Releases](https://github.com/dannote/pi-ios/releases) and extract to `vendor/`:\n   ```bash\n   tar -xzf vendor-libs.tar.gz -C vendor/\n   ```\n   \n   Or build from source (see [Building Dependencies](#building-dependencies)).\n\n3. **Generate Pi bundle**\n   \n   The Pi agent JavaScript bundle is not included in the repo. Generate it:\n   ```bash\n   cd /path/to/pi-coding-agent\n   bun run build:ios\n   cp dist/pi-ios-bundle.js /path/to/pi-ios/app/Pi/Resources/\n   ```\n\n4. **Generate Xcode project**\n   ```bash\n   cd app\n   xcodegen generate\n   ```\n\n5. **Open in Xcode and build**\n   ```bash\n   open Pi.xcodeproj\n   ```\n   \n   Select your device and build (⌘B).\n\n### Setting Up API Key\n\nPi requires an OpenRouter API key to access AI models. Create a `config.json` file in the app's Documents folder:\n\n**Option 1: Using devicectl (from Mac)**\n```bash\necho '{\"openrouter_api_key\": \"sk-or-v1-your-key-here\"}' \u003e /tmp/config.json\nxcrun devicectl device copy to \\\n  --device YOUR_DEVICE_UDID \\\n  --domain-type appDataContainer \\\n  --domain-identifier com.dannote.pi \\\n  --source /tmp/config.json \\\n  --destination Documents/config.json\n```\n\n**Option 2: Using Files app (on iPhone)**\n1. Open the Files app\n2. Navigate to \"On My iPhone\" → \"Pi\"\n3. Create a new file called `config.json`\n4. Add: `{\"openrouter_api_key\": \"sk-or-v1-your-key-here\"}`\n\n## Building Dependencies\n\nPi requires three main dependencies to be built for iOS:\n\n### 1. WebKit/JavaScriptCore\n\nBuild WebKit for iOS with C_LOOP interpreter enabled (required since JIT is not available on iOS):\n\n```bash\ncd ~/Development\ngit clone https://github.com/ArtSabintsev/WebKit.git\ncd WebKit\nmkdir build-ios-device \u0026\u0026 cd build-ios-device\n\ncmake .. \\\n    -G Ninja \\\n    -DCMAKE_BUILD_TYPE=Release \\\n    -DCMAKE_SYSTEM_NAME=iOS \\\n    -DCMAKE_OSX_SYSROOT=iphoneos \\\n    -DCMAKE_OSX_ARCHITECTURES=arm64 \\\n    -DPORT=JSCOnly \\\n    -DENABLE_STATIC_JSC=ON \\\n    -DENABLE_JIT=OFF \\\n    -DENABLE_C_LOOP=ON \\\n    -DENABLE_WEBASSEMBLY=OFF \\\n    -DENABLE_SAMPLING_PROFILER=OFF\n\nninja JavaScriptCore\n```\n\n### 2. Bun\n\nBuild Bun for iOS using the iOS port:\n\n```bash\ngit clone https://github.com/dannote/bun.git -b ios-port\ncd bun\nmkdir build/ios-device \u0026\u0026 cd build/ios-device\n\ncmake ../.. \\\n    -G Ninja \\\n    -DCMAKE_BUILD_TYPE=Release \\\n    -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchains/ios-device.cmake\n\nninja\n```\n\n### 3. Ghostty\n\nBuild Ghostty for iOS:\n\n```bash\ngit clone https://github.com/dannote/ghostty.git -b ios-manual-backend\ncd ghostty\n\nzig build \\\n    -Doptimize=ReleaseFast \\\n    -Dtarget=aarch64-ios \\\n    --build-file src/build.zig\n```\n\n## Architecture\n\n```\n┌─────────────────────────────────────────────────────┐\n│                     Pi for iOS                       │\n├─────────────────────────────────────────────────────┤\n│  SwiftUI App                                        │\n│    ├─ TerminalView (UIView + UIKeyInput)            │\n│    ├─ KeyboardAccessory (iOS 26 Liquid Glass)       │\n│    └─ BunGhosttyBridge (pipes stdin/stdout)         │\n├─────────────────────────────────────────────────────┤\n│  Ghostty Terminal (Metal GPU rendering)             │\n│    └─ Manual termio backend for iOS                 │\n├─────────────────────────────────────────────────────┤\n│  Bun Runtime (JSC with C_LOOP interpreter)          │\n│    ├─ iOS embedding API (bun_start, bun_eval)       │\n│    ├─ Stubs for iOS-unsupported features            │\n│    └─ Full npm package compatibility                │\n├─────────────────────────────────────────────────────┤\n│  Pi Coding Agent (bundled JavaScript)               │\n│    └─ Interactive mode, tools, AI integration       │\n└─────────────────────────────────────────────────────┘\n```\n\n## Key Technical Achievements\n\n- **Bun on iOS**: First working port of Bun to iOS, using JSC's C_LOOP interpreter instead of JIT\n- **Ghostty on iOS**: Manual termio backend for Ghostty's GPU-rendered terminal\n- **No Private APIs**: App Store compliant - no JIT, no private frameworks\n- **Native Performance**: ~600ms cold start, full npm package support\n\n## Known Limitations\n\n- **No JIT**: JavaScript runs in interpreter mode (~10x slower than JIT)\n- **No WebAssembly**: Disabled due to JIT requirement\n- **No CPU Profiler**: Sampling profiler requires JIT\n- **Memory**: C_LOOP interpreter uses more memory than JIT\n\n## Related Projects\n\n- [pi-coding-agent](https://github.com/mariozechner/pi-coding-agent) - The pi coding agent\n- [Bun iOS Port](https://github.com/dannote/bun/tree/ios-port) - Bun runtime for iOS\n- [Ghostty iOS](https://github.com/dannote/ghostty/tree/ios-manual-backend) - Ghostty terminal for iOS\n\n## License\n\nMIT License - see [LICENSE](LICENSE) for details.\n\n## Contributing\n\nContributions welcome! Please read the contributing guidelines before submitting PRs.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannote%2Fpi-ios","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdannote%2Fpi-ios","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdannote%2Fpi-ios/lists"}