Sign inSign up

credkellar/ios2termux

By credkellar

β€’Updated 4 days ago

iOS to real Termux, honestly: SSH from iPhone, translate commands & paths, Carbon 4 decides safely.

Image
Machine learning & AI
Developer tools
Operating systems
1

72

credkellar/ios2termux repository overview

⁠iOS2Termux πŸ“±βž‘οΈπŸš

iOS to Termux with Gemini Carbon 4 Extended Thinking 🧠✨

Created by Darion Kellar · GitHub: credkellar/iOS-Termux⁠

Python Gemini Carbon 4 Termux iOS Tests Checks Dependencies Routes Translations HOLD Gates License CI Docker Publish

🚫 Termux is Android-only. There is NO Termux for iOS. You cannot install a Termux APK / .deb on an iPhone, and no jailbreak is offered or required. 🐚 iOS shells are NOT Termux: iSH (Alpine, apk), a-Shell and Blink Shell are cockpits/clients, not Termux. βœ… What works: SSH from the iPhone into a real Termux on an Android device (port 8022), a Termux-style cloud box, command translation for iOS shells, and shared-storage file transfer via ~/storage/downloads.


β πŸ“– What is this about?

This project started with a simple question: "How do I use Termux when my phone is an iPhone?" πŸ“±

The honest answer has four parts:

  1. 🚫 Native Termux on iOS does not exist. Termux is built for Android β€” its packages, its $PREFIX paths, its .deb files. An iPhone cannot install an APK, and there is no iOS build. Every "Termux for iPhone" claim is fake.
  2. 🐚 iOS shells are real, but they are not Termux. iSH runs Alpine Linux in user mode (apk, not pkg). a-Shell and Blink Shell are useful cockpits/clients. None of them becomes Termux, and none can host sshd.
  3. βœ… The winning route is SSH. Put real Termux on an Android device, start sshd (port 8022), and ssh in from iSH / Blink / Termius on the iPhone β€” same LAN, or Tailscale across networks. The iPhone is the cockpit; the Android device runs the real Termux.
  4. ☁️ No Android handy? A cloud Linux box (Codespaces from the phone browser) with a pkg-style wrapper feels Termux-like, Termux commands translate to iSH equivalents for local work, and files move through iOS Files into Termux ~/storage/downloads.

iOS2Termux turns that answer into a tool: it classifies every route honestly, translates commands and paths both ways, plans the exact SSH / cloud / transfer setup phone-first, and HOLDs πŸ›‘ the impossible or dangerous requests β€” decided by Gemini Carbon 4 Extended Thinking, gated by hard HOLD rules it can never override.


⁠🎯 What this does?

  • πŸ—‚οΈ Classifies 8 routes β€” impossible / shell-only / ssh-client / real-Termux / cloud / transfer-only β€” with an honest verdict for each
  • πŸ”€ Translates 16 command pairs both ways β€” Termux <-> iOS (iSH): pkg install <-> apk add, clipboard, TTS, open, and more
  • πŸ›£οΈ Translates paths both ways β€” ~/storage/downloads <-> iOS Files On My iPhone/Downloads, Termux $HOME/$PREFIX <-> iSH paths, and the ~/downloads private-folder warning ⚠️
  • πŸ›‘οΈ Rejects hostile shell input β€” ; rm -rf, $(...), backticks and pipes into sh are refused before they can become a command
  • πŸ—ΊοΈ Plans any route β€” phone-first taps, the exact commands for each side, and generated files
  • πŸ“„ Generates setup-termux.sh β€” the one-time Android-side setup (openssh, storage, sshd, whoami, ip addr)
  • πŸ“„ Generates an ssh config snippet + a translate cheat-sheet (.md)
  • 🧠 Decides with Gemini Carbon 4 Extended Thinking β€” MAP -> MODEL -> STRESS -> DECIDE, extended tier (32768 budget) by default
  • πŸ›‘ Enforces 8 HOLD gates β€” impossible claims, public sshd with no auth, secrets in command history, rm -rf on shared storage, unextracted archives, the private-downloads trap
  • πŸ”— Keeps a hash-chained blackbox log of plans and verdicts, tamper-evident
  • πŸ€– Registers freeai advisor seats by name only β€” including the Muse seat (MODEL_API_KEY, Meta, pay-as-you-go) β€” advisors can recommend, they can never override a HOLD

β πŸ”§ How this works?

⁠The truth table πŸ“‹
RouteReal Termux?Reality
Termux on iOS (termux_on_ios)❌Impossible β€” Android-only, no iOS build exists. HOLD.
APK / .deb on iOS (apk_on_ios)❌Impossible β€” iOS cannot install Android packages. HOLD.
iSH (ish_shell)❌ shell onlyAlpine shell on iOS: real shell + Python, Termux commands translate (pkg -> apk).
a-Shell (a_shell)❌ shell onlyNative iOS shell, its own command set. A cockpit, not Termux.
Blink Shell (blink_ssh)❌ client onlyA polished ssh/mosh client β€” connects to Termux, is not Termux.
SSH to Android Termux ⭐ (ssh_to_android_termux)βœ…Recommended. Real Termux + sshd on Android, iPhone ssh-es in (port 8022).
Cloud-Termux (cloud_termux)☁️ Termux-styleCloud Linux (e.g. Codespaces) + pkg-like wrapper, driven from the phone browser.
Files transfer (ios_files_transfer)πŸ“ transfer onlyiOS Files -> shared Download folder -> Termux ~/storage/downloads.
⁠The flow 🌊
  1. πŸ“± You pick a route (default: SSH into real Termux)
  2. 🧠 Carbon 4 runs MAP -> MODEL -> STRESS -> DECIDE; the HOLD gates run inside STRESS
  3. πŸ›‘ Any gate tripped = HOLD, printed with its reason β€” Carbon 4 can never loosen it
  4. πŸ—ΊοΈ Clear plans emit phone steps + exact commands + generated files
  5. πŸ”— The blackbox logs the plan and the verdict
β πŸ›‘ The HOLD gates
GateTrigger
native_termux_claimClaiming Termux runs natively on iOS
apk_install_on_iosInstalling a Termux APK / .deb on an iPhone
jailbreak_requiredA plan that requires a jailbreak (none is offered, none is needed)
sshd_public_no_authExposing sshd to the public internet with no auth / password-only
secrets_in_command_historyAn API key pasted as a plain command argument (lands in shell history)
rm_rf_storagerm -rf against ~/storage or / β€” wipes shared phone storage
unextracted_archive_runTrying to run Python from inside a .zip without extracting it first
private_downloads_confusionExpecting shared files in ~/downloads β€” that is Termux's private folder; shared files belong in ~/storage/downloads
⁠🧠 Gemini Carbon 4 Extended Thinking
  • Engine: gemini-2.5-pro Β· Model ID: google/gemini-carbon-4-extended-pro-thinking
  • Thinking tiers: standard 2048 Β· deep 8192 Β· extended 32768 (default)
  • Phases: MAP (name the action + route) -> MODEL (require the facts) -> STRESS (worst cases + the HOLD gates) -> DECIDE (strictest verdict: HOLD / PROCEED)
  • Offline structure is authoritative. A live polish (only when GEMINI_API_KEY is present β€” detected by name only, value never read) can only tighten a verdict, never loosen one.
  • Negative controls, locked in by tests: a plain pkg install python translation must NOT escalate to HOLD βœ… Β· a local iSH ls / python3 script.py must NOT be held just because Termux is absent βœ… Β· a single benign transfer to ~/storage/downloads must PROCEED βœ…
β πŸ—οΈ Architecture
flowchart TD
    A["πŸ“± iPhone<br/>iSH / Blink / Safari"] --> B["main.py<br/>ONE interface"]
    B --> C["πŸ—ΊοΈ planner.py<br/>route β†’ plan"]
    C --> D["🧠 carbon4.py + brains.py<br/>Carbon 4 decides · gates HOLD"]
    D -->|HOLD πŸ›‘| E["exit 2<br/>reason printed"]
    D -->|clear βœ…| F["πŸ“‹ phone steps + commands + files"]
    C --> G["πŸ—‚οΈ routes.py<br/>8 routes, honestly classified"]
    C --> H["πŸ”€ translate.py<br/>16 pairs + paths, injection-proof"]
    F --> I["🐧 REAL Termux on Android<br/>sshd :8022"]
    F --> J["☁️ Cloud-Termux<br/>Codespaces + pkg wrapper"]
    B --> K["πŸ”— blackbox.py<br/>hash-chained log"]
    B --> L["πŸ€– freeai.py<br/>advisor seats, names only"]

⁠😎 Why is this cool?

Because it tells the truth and then makes the truth useful. Most "Termux on iPhone" content is either a lie or a dead end. This project draws the exact line between impossible, shell-only, and actually-works β€” then automates the part that works, end to end, from a phone, with an extended-thinking decider that is forbidden from overriding its own safety gates. πŸ“±βœ¨

β πŸ”Ÿ 10 reasons why this is cool

  1. 🧭 Honesty as a feature β€” the impossible routes are labelled impossible, in code, with gates that enforce it
  2. ⭐ One recommended route β€” SSH into real Termux: every pkg, path and tool, from your iPhone
  3. πŸ”€ A real translator β€” 16 command pairs + path translation, both directions, not a blog-post table
  4. ⚠️ The downloads trap is encoded β€” ~/downloads (private) vs ~/storage/downloads (shared) is a gate, a warning, and a test
  5. 🧠 Extended thinking, on a leash β€” Carbon 4 decides with a 32768 budget, and a HOLD still always wins
  6. βœ… Negative controls β€” tests prove benign work (translations, local iSH, one file transfer) is NOT over-held
  7. πŸ“„ Files that generate themselves β€” setup-termux.sh, the ssh config, and the cheat-sheet come out of the planner
  8. πŸ›‘οΈ Injection-proof by design β€” a hostile command can never smuggle shell syntax into a plan
  9. 0️⃣ Zero dependencies β€” pure Python 3.12 stdlib; runs anywhere Python runs, including inside its own Docker image
  10. πŸ”— Tamper-evident memory β€” plans and verdicts are hash-chained in the blackbox

⁠🐳 Run it

docker pull credkellar/ios2termux:latest
docker run --rm credkellar/ios2termux
# πŸ§ͺ expect: CHECKS 48/48 PASS Β· VERDICT: PROCEED

From source:

git clone https://github.com/credkellar/iOS-Termux.git
cd iOS-Termux
python3 main.py                                    # self-check
python3 main.py --plan                             # the recommended SSH plan
python3 main.py --translate "pkg install python" --to ios

β πŸ“‹ The numbers

  • πŸ§ͺ 43 tests passed Β· CHECKS 48/48 Β· 0️⃣ zero dependencies (pure Python 3.12 stdlib)
  • πŸ›‚ 8 routes classified Β· πŸ”€ 16 command translations + 5 path translations, both directions
  • πŸ›‘ 8 HOLD gates Β· 🧠 Gemini Carbon 4 Extended Thinking decides (32768 extended budget) and can never override a HOLD
  • πŸ“± Phone = cockpit Β· πŸ€– Android Termux = engine Β· πŸ” SSH port 8022 = the bridge

Tag summary

Content type

Image

Digest

sha256:e463baa48…

Size

41.3 MB

Last updated

4 days ago

docker pull credkellar/ios2termux