ESC
开源 4 分钟阅读

ipatool:可从 App Store 搜索并下载 ipa 应用包的开源命令行工具

ipatool 是一款开源命令行工具,可在 App Store 中搜索 iOS、iPadOS、tvOS 和 visionOS 应用,并下载对应的 ipa 应用包。用户可用 Apple ID 登录、获取应用授权、查看已购应用与历史版本,并下载加密的 ipa 文件。该工具支持通过 Homebrew 安装,使用 Go 编写,遵循 MIT 协议开源,适合开发者和侧载用户使用。

来源:GitHub日榜

IPATool

Release License

ipatool 是一个命令行工具,允许你在 App Store 上搜索 iOS、iPadOS、tvOS 和 visionOS 应用,并下载应用包(称为 ipa 文件)的副本。

Demo

系统要求

  • 受支持的操作系统(Windows、Linux 或 macOS)。
  • 已设置好并可用于 App Store 的 Apple ID。

安装

手动安装

你可以从 GitHub releases 获取最新版本的 ipatool。

包管理器(macOS)

你可以使用 Homebrew 安装 ipatool。

$ brew install ipatool

使用方法

要与 App Store 进行身份验证,请使用 auth 命令。

Authenticate with the App Store

Usage:
  ipatool auth [command]

Available Commands:
  info        Show current account info
  login       Login to the App Store
  revoke      Revoke your App Store credentials

Flags:
  -h, --help   help for auth

Global Flags:
      --format format     sets output format for command; can be 'text', 'json' (default text)
      --non-interactive   run in non-interactive session
      --verbose           enables verbose logs

Use "ipatool auth [command] --help" for more information about a command.

要在 App Store 上搜索应用,请使用 search 命令。

Search for iOS, iPadOS, tvOS, and visionOS apps available on the App Store

Usage:
  ipatool search <term> [flags]

Flags:
  -h, --help              help for search
  -l, --limit int         maximum amount of search results to retrieve; visionOS supports up to 12 (default 5)
      --platform string   Platform to search: iphone (iOS), ipad (iPadOS), appletv (tvOS), or visionos

Global Flags:
      --format format     sets output format for command; can be 'text', 'json' (default text)
      --non-interactive   run in non-interactive session
      --verbose           enables verbose logs

要获取应用的授权(license),请使用 purchase 命令。

Obtain a license for the app from the App Store

Usage:
  ipatool purchase [flags]

Flags:
  -b, --bundle-identifier string   Bundle identifier of the target iOS app (required)
  -h, --help                       help for purchase

Global Flags:
      --format format     sets output format for command; can be 'text', 'json' (default text)
      --non-interactive   run in non-interactive session
      --verbose           enables verbose logs

要列出已认证账户拥有的应用,请使用 list-purchases 命令。结果按购买日期排序,最新的排在最前。

List apps owned by the authenticated App Store account

Usage:
  ipatool list-purchases [flags]

Flags:
  -h, --help              help for list-purchases
  -l, --max-results int   maximum number of apps to return per page (default 10)
  -p, --page int          page of owned apps to return (default 1)

Global Flags:
      --format format                sets output format for command; can be 'text', 'json' (default text)
      --keychain-passphrase string   passphrase for unlocking keychain
      --non-interactive              run in non-interactive session
      --verbose                      enables verbose logs

要获取可下载的应用版本列表,请使用 list-versions 命令。

List the available versions of an iOS app

Usage:
  ipatool list-versions [flags]

Flags:
  -i, --app-id int                 ID of the target iOS app (required)
  -b, --bundle-identifier string   The bundle identifier of the target iOS app (overrides the app ID)
  -h, --help                       help for list-versions

Global Flags:
      --format format                sets output format for command; can be 'text', 'json' (default text)
      --keychain-passphrase string   passphrase for unlocking keychain
      --non-interactive              run in non-interactive session
      --verbose                      enables verbose logs

要下载 ipa 文件的副本,请使用 download 命令。

Download (encrypted) iOS, iPadOS, tvOS, and visionOS app packages from the App Store

Usage:
  ipatool download [flags]

Flags:
  -i, --app-id int                   ID of the target app (required)
  -b, --bundle-identifier string     The bundle identifier of the target app (overrides the app ID)
      --external-version-id string   External version identifier of the target app (defaults to latest version when not specified)
  -h, --help                         help for download
  -o, --output string                The destination path of the downloaded app package
      --platform string              Platform to download for: iphone (iOS), ipad (iPadOS), appletv (tvOS), or visionos
      --purchase                     Obtain a license for the app if needed

Global Flags:
      --format format                sets output format for command; can be 'text', 'json' (default text)
      --keychain-passphrase string   passphrase for unlocking keychain
      --non-interactive              run in non-interactive session
      --verbose                      enables verbose logs

要解析 list-versions 命令返回的外部版本标识符,请使用 get-version-metadata 命令。

Retrieves the metadata for a specific version of an app

Usage:
  ipatool get-version-metadata [flags]

Flags:
  -i, --app-id int                   ID of the target iOS app (required)
  -b, --bundle-identifier string     The bundle identifier of the target iOS app (overrides the app ID)
      --external-version-id string   External version identifier of the target iOS app (required)
  -h, --help                         help for get-version-metadata

Global Flags:
      --format format                sets output format for command; can be 'text', 'json' (default text)
      --keychain-passphrase string   passphrase for unlocking keychain
      --non-interactive              run in non-interactive session
      --verbose                      enables verbose logs

注意: 该工具默认以交互模式运行。如果在自动化环境中运行,请使用 --non-interactive 标志。

编译

该工具可以使用 Go 工具链进行编译。

$ go build -o ipatool

单元测试可以通过以下命令执行。

$ go generate ./...
$ go test -v ./...

许可证

IPATool 基于 MIT 许可证 发布。