Skip to content

About

Fast, low-memory TUI & CLI for searching, purchasing, and downloading iOS App Store IPA files (including older versions) in Rust.

Topics

Resources

Contributing

Stars

100 stars

Watchers

0 watching

Forks

Repository files navigation

ipatool-rs logo

ipatool-rs — App Store IPA Downloader TUI & CLI

Search, purchase, and download iOS App Store IPA files — including older app versions — straight from your terminal.
A fast, low-memory Rust alternative to ipatool featuring an interactive TUI, streaming downloads, and a lightweight auth/v1/native + X-Apple-AMD signing engine.

Crates.io Latest Release GitHub Downloads CI License: MIT Telegram Group GitHub Stars

Quickstart · Installation · Usage · Migrating from ipatool · How It Works · FAQ · Discussions · Telegram · 中文文档

ipatool-rs live TUI and CLI demo


Quickstart

Install ipatool and launch the interactive terminal UI — or grab an IPA in three commands:

# 1. Install (macOS / Linux via Homebrew — see below for Windows, Cargo, and curl installers)
brew install Kosthi/tap/ipatool-rs

# 2a. Launch the interactive TUI (login, search, purchase, and download in one screen)
ipatool

# 2b. Or use the CLI directly
ipatool auth login --email your@apple.id
ipatool download -b com.tencent.xin --purchase

Need to downgrade an iOS app to an older version?

ipatool version list -b com.tencent.xin
ipatool download -b com.tencent.xin --version-id 865432100

Why ipatool-rs?

While upstream Go ipatool has also been updated for Apple's newer Store authentication, ipatool-rs takes a fundamentally lighter, Rust-native engineering approach focused on low memory usage, fast execution, tiny binary size, and an interactive terminal UI:

  • Lightweight C-ABI Signing vs. Full ObjC Runtime Emulation: To satisfy Apple's auth/v1/native SAP and Store ADI (X-Apple-AMD) checks, upstream ipatool unpacks ~78 MB of macOS IPSW shared-cache images (AppleMediaServices, adid, fairplayd, FairPlayIOKit, etc.) and emulates an Objective-C/Swift runtime bridge on top of Go's GC heap. ipatool-rs instead drives self-contained C entry points (CommerceKit/CoreFP + ~4 MB Android libCoreADI.so with zero daemon, kernel, or ObjC runtime dependencies) inside Unicorn — cutting cached asset size nearly in half and keeping peak RAM usage minimal.
  • Constant-Memory Streaming & Zero-Recompression Patching: Downloads stream directly to disk in small chunks (O(1) memory whether an IPA is 50 MB or 4 GB) with HTTP Range resume. When injecting iTunesMetadata.plist and SINF DRM data, ipatool-rs copies existing ZIP entries as raw compressed streams (raw_copy_file) without decompressing and re-deflating the payload.
  • ~9× Smaller Distribution & Zero GC Overhead: Prebuilt release archives are ~3 MB (vs. ~25–27 MB for upstream Go builds), compiled to native code with rustls (no OpenSSL dependency) and zero garbage-collector pauses.
  • Interactive TUI + Concurrent Download Queue: Beyond scriptable CLI subcommands, running ipatool launches a full keyboard-driven terminal UI (ratatui) to search, claim free licenses, and manage multiple background downloads in one session.

Common Use Cases

  • Downgrade iOS apps: List historical version-id builds from Apple's servers and download older .ipa releases without needing discontinued iTunes 12.6.5.
  • Archive apps before delisting: Keep local, patch-ready .ipa backups (with iTunesMetadata.plist and SINF injected) for devices authorized under your Apple ID.
  • Interactive terminal workflow: Browse App Store results, inspect app details, claim free licenses, and monitor concurrent downloads in a keyboard-driven TUI.
  • Automation & CI pipelines: Combine --format json and --non-interactive for low-overhead scripted metadata lookups and IPA retrieval.

Comparison

Aspect ipatool (Go, v2.8+) ipatool-rs (Rust)
Interactive TUI ❌ CLI only ✅ Built-in keyboard-driven TUI + CLI
Background download queue ❌ Single CLI invocation ✅ Concurrent queue in TUI Downloads tab
Release package size ~25–27 MB compressed ✅ ~2.7–4.3 MB compressed (~9× smaller)
Memory model Go GC + ObjC runtime bridge heap ✅ Zero-GC Rust + direct C-ABI shims (O(1) streaming RAM)
Signing engine & cached assets ~78 MB macOS IPSW / dyld cache (AppleMediaServices, fairplayd, etc.) ✅ ~42 MB standalone CommerceKit + self-contained libCoreADI.so
IPA patching I/O Rewrites archive entries ✅ Zero-recompression raw_copy_file stream copy
Apple ID auth, 2FA & X-Apple-AMD ✅ Supported ✅ Supported (with auto re-auth on expired token)
Historical versions & Range resume ✅ Supported ✅ Supported (version list, --version-id, Range resume)
Credential storage Native OS keychain ✅ Native OS keychain (macOS / Linux / Windows)
Reusable core library Go internal/pkg modules ✅ Standalone async ipatool-core crate (tokio + rustls)
Scope Multi-platform packages (incl. macOS .pkg) + MCP Focused, lightweight iOS .ipa TUI & CLI

Features

  • Interactive TUI mode: Run ipatool with no arguments for Search, Library, Downloads, and Account tabs.
  • Signed sign-in & device proof: Performs Apple's SAP handshake and Store ADI (X-Apple-AMD) device provisioning required by auth/v1/native since November 2026 — without redistributing Apple binaries.
  • Multi-storefront search: Query App Store catalogs across any country code (--country US, JP, CN, etc.).
  • Zero-recompression IPA patching: Injects purchase metadata (iTunesMetadata.plist) and SINF authorization data by copying compressed ZIP streams directly without re-deflating the app payload.
  • Resilient downloads & sessions: Streams large IPA files with HTTP Range resume in CLI mode and automatic token refresh when stored credentials expire.
  • Script-friendly CLI: Structured --format json output and --non-interactive mode for headless environments.

Installation

Homebrew (macOS / Linux)

brew install Kosthi/tap/ipatool-rs

Scoop (Windows)

scoop bucket add kosthi https://github.com/Kosthi/scoop-bucket
scoop install kosthi/ipatool-rs

One-Line Installer (macOS / Linux / Windows)

# macOS / Linux
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/Kosthi/ipatool-rs/releases/latest/download/ipatool-rs-installer.sh | sh
# Windows PowerShell
powershell -ExecutionPolicy Bypass -c "irm https://github.com/Kosthi/ipatool-rs/releases/latest/download/ipatool-rs-installer.ps1 | iex"

Cargo / mise

# Install from source via Cargo
cargo install ipatool-rs

# Install prebuilt binary via cargo-binstall
cargo binstall ipatool-rs

# Or install prebuilt binary via mise (ubi backend)
mise use -g "ubi:Kosthi/ipatool-rs[exe=ipatool]"

Prebuilt Release Binaries

Download archives directly from GitHub Releases:

Platform Asset Install
Windows x64 ipatool-rs-x86_64-pc-windows-msvc.zip Extract and place ipatool.exe on your PATH.
macOS Apple Silicon ipatool-rs-aarch64-apple-darwin.tar.xz Extract and place ipatool on your PATH.
macOS Intel ipatool-rs-x86_64-apple-darwin.tar.xz Extract and place ipatool on your PATH.
Linux x64 ipatool-rs-x86_64-unknown-linux-gnu.tar.xz Extract and place ipatool on your PATH.
Linux ARM64 ipatool-rs-aarch64-unknown-linux-gnu.tar.xz Extract and place ipatool on your PATH.

Each release includes per-asset .sha256 checksums and a unified sha256.sum.

Build From Source

git clone https://github.com/Kosthi/ipatool-rs.git
cd ipatool-rs
cargo build --release

# Binary at target/release/ipatool

Usage

Terminal UI (TUI)

Launch the interactive TUI by running ipatool without subcommands:

ipatool

Built with ratatui and crossterm, the TUI lets you sign in, search the App Store, acquire free licenses, and manage concurrent downloads from the keyboard.

Keyboard Controls

Scope Key Action
Global q / Ctrl+C Quit
Tab / Shift+Tab Switch tabs
1–4 Jump directly to a tab
j / k or Up / Down Navigate the current list
Esc Cancel input or close popup
Search tab / or s Focus the search bar
Enter Run search
d Download selected app
p Purchase (obtain free license for) selected app
Downloads tab x Cancel selected download
c Clear finished downloads
Account tab l Log in
r Revoke stored credentials

CLI Usage

Note

First sign-in downloads ~50 MB once. Apple requires sign-in and store requests to carry an action signature and a Store ADI device proof generated by Apple's own code (see How It Works). Those components are fetched once via HTTP range requests, verified against pinned SHA-256 digests, and cached under ~/.ipatool/cache/ for all subsequent runs.

1. Authenticate with Apple ID

# Interactive login (prompts securely for password and 2FA code if needed)
ipatool auth login --email your@apple.id

# Pass password / 2FA code directly
ipatool auth login --email your@apple.id --password 'password' --auth-code 123456

# Inspect active session & storefront
ipatool auth info

# Log out and remove stored credentials
ipatool auth revoke

2. Search the App Store

ipatool search "WeChat" --limit 10
ipatool search "Telegram" --limit 5 --country US

3. Obtain a Free License & Download IPAs

By default, IPAs are saved in the current directory as {bundle_id}_{version_id}_{version}.ipa. Pass --purchase to automatically claim a free license if your account does not own the app yet.

# Download latest IPA and auto-purchase free license if needed
ipatool download -b com.tencent.xin --purchase

# Custom output path
ipatool download -b com.tencent.xin --purchase -o ~/Downloads/wechat.ipa

# Download by numeric App ID
ipatool download -i 414478124 --purchase

# Obtain a free license without downloading
ipatool purchase -b com.tencent.xin

4. List & Download Older App Versions (Downgrade)

# List all available external version IDs for an app
ipatool version list -b com.tencent.xin

# Inspect version metadata (display version string, release info)
ipatool version meta -b com.tencent.xin --version-id 865432100

# Download that exact historical version
ipatool download -b com.tencent.xin --version-id 865432100

Global Flags

--format <text|json>    Output format (default: text)
--verbose               Enable debug logging
--non-interactive       Disable interactive prompts (for scripts/CI)

Migrating from majd/ipatool

ipatool-rs keeps familiar CLI semantics so existing scripts require minimal changes:

Task majd/ipatool (Go) ipatool-rs
Sign in ipatool auth login -e ... ipatool auth login --email ...
Account info ipatool auth info ipatool auth info
Sign out ipatool auth revoke ipatool auth revoke
Search apps ipatool search "term" ipatool search "term" [--country US]
Purchase free license ipatool purchase -b <bundle_id> ipatool purchase -b <bundle_id>
Download latest IPA ipatool download -b <bundle_id> --purchase ipatool download -b <bundle_id> --purchase
List older versions ipatool list-versions -b <bundle_id> ipatool version list -b <bundle_id>
Version metadata ipatool get-version-metadata ... ipatool version meta -b <bundle_id> --version-id <id>
Interactive TUI Not available ipatool

How It Works

  1. Auth & Device Proof — Posts credentials to Apple's auth/v1/native endpoint with both an X-Apple-ActionSignature (SAP) and a Store-scoped X-Apple-AMD / X-Apple-AMD-M device proof, completing otp/1.5/finish provisioning automatically on first use. Handles 2FA, pod redirects, retry logic, OS keychain storage, and cookies.

    Producing both proofs requires running Apple's own signing routines. On first use, ipatool-rs:

    • HTTP range-reads a public OS X 10.9 update package (~33 MB of 1.27 GB) to extract CommerceKit, CommerceCore, and CoreFP;
    • HTTP range-reads Apple's official Android Apple Music APK (~2 MB of 142 MB) to extract x86-64 libCoreADI.so and libstoreservicescore.so;
    • Downloads a prebuilt Unicorn CPU emulator and executes those x86-64 Mach-O and ELF binaries in-process with their external imports serviced directly from Rust.

    Every artifact is verified against pinned SHA-256 digests before execution and cached under ~/.ipatool/cache/ (with persistent ADI provisioning state under ~/.ipatool/adi/). No Apple code is redistributed with this repository or its binaries.

  2. Search / Lookup — Queries the public iTunes Search API for app metadata and storefront-specific results.

  3. Purchase — Sends a buy request to buy.itunes.apple.com with Store AMD headers and STDQ pricing, falling back to GAME for Apple Arcade-style responses.

  4. Download — Requests the signed CDN URL and SINF DRM blobs from Apple's volumeStoreDownloadProduct endpoint with Store AMD headers, then streams the archive with HTTP Range resume support.

  5. Patch — Rebuilds the ZIP archive on the fly, injecting iTunesMetadata.plist and SC_Info/*.sinf so the resulting .ipa installs cleanly on any device authorized for your Apple ID.

  6. TUI — Wraps ipatool-core in an async ratatui + crossterm interface with non-blocking background workers for search, authentication, licensing, and queued downloads.

Project Structure

ipatool-rs/
|-- Cargo.toml                  # Workspace root
|-- media/                      # README logo and TUI demo assets
`-- crates/
    |-- ipatool-core/           # Reusable library crate
    |   `-- src/
    |       |-- adi/            # Store ADI (X-Apple-AMD) runtime & ELF loader
    |       |-- api/            # Apple Store API endpoints
    |       |-- client/         # HTTP client, plist parser, cookie jar
    |       |-- model/          # Account, App, Platform, StoreFront types
    |       |-- ipa/            # IPA patching & HTTP range ZIP reader
    |       |-- sap/            # SAP signing runtime, Mach-O loader & Unicorn engine
    |       |-- error.rs        # Structured error hierarchy
    |       |-- credential.rs   # Native OS keychain storage
    |       `-- guid.rs         # Device GUID generation
    `-- ipatool-cli/            # Binary crate (`ipatool`)
        `-- src/
            |-- main.rs         # CLI entry point & clap definitions
            |-- output.rs       # Text / JSON formatters
            |-- tui/            # Interactive ratatui terminal UI
            `-- commands/       # Subcommand handlers

FAQ

Is my Apple ID password stored on disk?
No. After a successful login, ipatool-rs stores a session password_token issued by Apple plus non-sensitive account metadata inside your OS keychain (macOS Keychain, Linux libsecret, or Windows Credential Manager) — never in a plain-text file. If you log in interactively, your password is never persisted; the keychain entry only stores a password when you explicitly pass --password on the CLI for unattended script re-authentication.
Does this bypass DRM or violate Apple's Terms of Service?
No. ipatool-rs downloads apps you have legitimately purchased or claimed a free license for, identical to downloading from the App Store. Downloaded IPAs retain FairPlay DRM tied to your Apple ID and will only install on devices authorized under that account. Review Apple's Terms of Service for your jurisdiction and use case.
How does ipatool-rs keep memory and disk usage lower than other Store clients?
Instead of extracting ~78 MB of macOS IPSW shared-cache frameworks (AppleMediaServices, fairplayd, adid) and emulating an Objective-C runtime, ipatool-rs drives compact, self-contained C libraries (CommerceKit/CoreFP + ~4 MB Android libCoreADI.so) directly in Unicorn. Downloads stream straight to disk in constant memory, and IPA patching uses raw ZIP stream copying (raw_copy_file) without decompressing or re-encoding multi-gigabyte app payloads.
Why does the first login download ~50 MB?
Generating valid SAP and Store ADI proofs requires executing Apple's own signing libraries. On first login, ipatool-rs range-reads ~35 MB of Apple packages plus a ~15 MB prebuilt Unicorn emulator, verifies every file against pinned SHA-256 hashes, and caches them in ~/.ipatool/cache/. Subsequent runs start instantly.
Login fails with "failed to establish a SAP signing session". How do I fix it?
Re-run the command with --verbose to inspect the root cause. If integrity verification failed (usually caused by an interrupted network download), remove ~/.ipatool/cache/ and run ipatool auth login again. If the issue persists, please open an issue with the --verbose output (redacting your email).
I get a 2FA prompt every time I run a command.
Your stored session token has likely expired. Run ipatool auth login once to refresh credentials in your OS keychain. For automated scripts, pass --non-interactive after establishing a valid session.
Which App Store countries / storefronts are supported?
All storefronts supported by the iTunes Search API. Pass --country <ISO-3166-1-alpha-2> (for example --country US, --country JP, --country CN) when searching. Downloads automatically use the storefront associated with your logged-in Apple ID.

Community

  • Telegram — join @ipatool_rs for quick help (English & 中文 topics) and release announcements.
  • Discussions — usage questions, ideas, and downgrade workflows.
  • Issues — reproducible bugs (please attach --verbose output with your Apple ID email redacted).

Star History

Star History Chart

License

Released under the MIT License.

About

Fast, low-memory TUI & CLI for searching, purchasing, and downloading iOS App Store IPA files (including older versions) in Rust.

Topics

Resources

Contributing

Stars

100 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages