opencode-termux
Installation
Review the source and dependencies with a prompt. A package is available to download.
Install with an AI assistant
Copy the prompt so your assistant can review the pinned revision and dependencies first.
View promptHide prompt
Check whether SkillPI Skill Finder is installed for your current agent. If it is missing, install and enable it using the official instructions at https://github.com/Findskills/skillpi. Then use Skill Finder to locate and install "opencode-termux" from this exact SkillPI detail page: https://skillpi.com/skills/deepskill-fcb5aeb5b87b568becf6e46b7cc567d5563b820c9f71269eb506526e1f0d8698. Verify the upstream source and version against https://skillhub.cn/skills/user_d11b9ffb/opencode-android-guide before installing. If they do not match, stop and report the mismatch. Report the installed path and source version.
Source and setup
skillhub.cn
Setup guidance pending
See the original source for supported tools, dependencies, and permissions.
Installation test pending
Complete runtime architecture and installation guide for OpenCode on Termux/Android, covering the glibc ELF binary compiled with Bun, the grun wrapper, plugin layer, configuration/data directories, log diagnostics, and provider model configuration, plus manual installation steps and common troubleshooting.
Introduction source: third_party · user_d11b9ffb · 1.0.0 Reference
SkillPi interpretation
- Tasks
- Translation pending; see source documentation.
- Audience
- Not specified in the source documentation.
- Inputs and outputs
- Not specified in the source documentation.
- Software, accounts and paid services
- Not specified in the source documentation.
- Limits and differences
- Not specified in the source documentation.
- Testing
- Not tested
Browse files
Frontmatter
name: opencode-termux
description: OpenCode (opencode-ai) 在 Termux/Android 上的完整运行时架构与安装指南 — Bun 编译的 glibc ELF 二进制、grun 包装、插件层、配置/数据目录、日志诊断、provider 模型配置。包含手动安装步骤和常见问题排查。
source: auto-skill
extracted_at: '2026-07-11T00:04:14.364Z'
updated_at: '2026-07-11'
github: https://github.com/leemwood/opencode-android-guideOpenCode 在 Termux 上的运行架构
OpenCode (opencode-ai) 是 Bun 编译的单文件 CLI 工具,在 Termux 上通过 glibc-runner 兼容层运行。
完整教程已发布至 GitHub: https://github.com/leemwood/opencode-android-guide
为什么需要特殊处理
OpenCode 的 Linux ARM64 二进制是标准 glibc ELF(Bun 编译,内嵌 Node.js 运行时)。Android 使用 bionic libc,无法直接执行。需通过 glibc-runner (grun) 兼容层运行。
安装速览
前置条件
pkg install glibc-runner glibc glibc-libstdc++ nodejs-lts proot
手动安装(推荐)
# 1. 下载二进制(从 opencode-linux-arm64 npm 子包)
npm pack opencode-linux-arm64 --pack-destination /tmp/
cd $PREFIX/bin
tar xzf /tmp/opencode-linux-arm64-*.tgz --strip-components=2 package/bin/opencode
mv opencode opencode.real
# 2. 创建 grun 包装脚本
cat > $PREFIX/bin/opencode << 'EOF'
#!/data/data/com.termux/files/usr/bin/bash
exec grun $PREFIX/bin/opencode.real "$@"
EOF
chmod +x $PREFIX/bin/opencode
# 3. 验证
opencode --version
# 4. 安装插件层(首次运行自动创建,也可手动准备)
mkdir -p ~/.config/opencode
cd ~/.config/opencode
echo '{"dependencies":{"@opencode-ai/plugin":"最新版本号"}}' > package.json
npm install
npm meta 包结构
opencode-ai— meta 包(7.9KB),通过optionalDependencies按平台拉取子包opencode-linux-arm64— ARM64 Linux 子包(~69MB 压缩,~188MB 解压),仅含bin/opencode二进制
架构层次
opencode 命令 ($PREFIX/bin/opencode)
└─ bash 包装脚本 → grun $PREFIX/bin/opencode.real
└─ glibc-runner 兼容层
└─ opencode.real (175MB Bun-compiled ELF)
└─ 加载 ~/.config/opencode/node_modules/@opencode-ai/plugin/
文件布局
| 路径 | 用途 |
|---|---|
$PREFIX/bin/opencode |
bash 包装脚本,调用 grun $PREFIX/bin/opencode.real "$@" |
$PREFIX/bin/opencode.real |
主程序本体,Bun 编译的 64-bit ARM ELF(~175MB),内含 Node.js 运行时 |
~/.config/opencode/package.json |
npm 依赖声明,锁定 @opencode-ai/plugin 版本 |
~/.config/opencode/node_modules/@opencode-ai/plugin/ |
插件代码(TypeScript 编译产物在 dist/) |
~/.config/opencode/opencode.jsonc |
用户配置(模型、权限等) |
~/.local/share/opencode/opencode.db |
SQLite 数据库(session、状态持久化) |
~/.local/share/opencode/log/opencode.log |
运行日志(JSON 行格式) |
二进制特征识别
file $PREFIX/bin/opencode.real
# ELF 64-bit LSB executable, ARM aarch64, dynamically linked,
# interpreter /lib/ld-linux-aarch64.so.1
readelf -d $PREFIX/bin/opencode.real | grep NEEDED
# libc.so.6, ld-linux-aarch64.so.1, libpthread.so.0, libdl.so.2, libm.so.6
strings $PREFIX/bin/opencode.real | grep -i bun | head -3
# BUN_1.2 ← 确认是 Bun 编译产物
# node_api_* 符号也大量存在(内嵌 Node.js 运行时)
配置结构
~/.config/opencode/opencode.jsonc 最小示例:
{
"$schema": "https://opencode.ai/config.json"
}
插件配置在 ~/.config/opencode/node_modules/@opencode-ai/plugin/:
dist/index.js— 主入口dist/tool.js— 工具定义dist/tui.js— 终端 UIdist/v2/effect/— Effect 框架集成
依赖链:@opencode-ai/sdk + @ai-sdk/provider + effect + zod
运行时行为(从日志可见)
日志位于 ~/.local/share/opencode/log/opencode.log,JSON 行格式:
timestamp=... level=INFO run=<id> message="creating instance" directory=...
timestamp=... level=INFO run=<id> message="shell tool using shell" shell=.../glibc/bin/bash
timestamp=... level=INFO run=<id> message=stream providerID=opencode-go modelID=deepseek-v4-pro
关键特征:
- Shell: 使用 glibc bash(
$PREFIX/glibc/bin/bash),不是 Termux 原生 bash - Provider:
opencode-go(OpenCode SDK Go 实现) - Model: 默认
deepseek-v4-pro - 文件监控: inotify backend(Linux 内核原生)
- LSP/Formatter: 默认全部禁用
- Session: 自动创建,格式
ses_<id>
版本更新
# 更新二进制
npm pack opencode-linux-arm64 --pack-destination /tmp/
cd $PREFIX/bin
tar xzf /tmp/opencode-linux-arm64-*.tgz --strip-components=2 package/bin/opencode
mv opencode opencode.real
# 更新插件层
cd ~/.config/opencode && npm install @opencode-ai/plugin@latest
常见问题
FFF 初始化警告
level=WARN message="failed to initialize fff"
error="Can not run certain FFF features in a file system root or home directories."
文件选择器(fff = fast file finder)在 home 目录下有限制,不影响功能。在具体项目目录下运行以避免此警告。
models.dev 超时
level=ERROR message="Failed to fetch models.dev" cause=Cause([Fail(TimeoutError)])
网络问题导致模型列表拉取失败,不影响已配置模型的使用。
No such file or directory 错误
二进制是 glibc ELF,检查 grun 是否安装 (pkg list-installed | grep glibc-runner) 和包装脚本是否正确。
/tmp 写入权限
Termux /tmp 为 shell:shell 属主,app 用户无写权限。修复:
export TMPDIR="$PREFIX/tmp"
export TMP="$PREFIX/tmp"
export TEMP="$PREFIX/tmp"
与其他技能的关联
- 安装过程 →
npm-glibc-meta(meta 包 + glibc ELF 通用模式) - npm 平台绕过 →
termux-cli-wrapper(--force+ proot/tmpbind mount) - glibc 包生态 →
termux-glibc-packages
Current listing version
1.0.0
Safety and assessment details
Quality assessment
Out of 100 · Assessment report from SkillPi LAB.
Areas to improve
-
缺少明确的 When to Use 章节 Reported severity: Minor
文档中未明确说明何时使用此 Skill,虽然从内容可以推断,但缺少显式说明
Recommendation: 建议在文档开头添加 'When to Use' 章节,明确说明此 Skill 的适用场景
Highlights
- 提供 OpenCode 在 Termux/Android 上的完整运行时架构与安装指南
- 包含详细的手动安装步骤和常见问题排查
- 解决用户在 Android 设备上运行 OpenCode 的具体痛点
Areas to improve
-
触发词可进一步细化 Reported severity: Minor
虽然触发词覆盖合理,但可考虑添加更多与 Android 开发相关的关键词
Recommendation: 建议在 description 中添加更多相关关键词,如 'Android development', 'mobile coding' 等
Highlights
- description 完整描述了 Skill 的核心功能和使用场景
- 触发词覆盖合理,包括多个关键技术术语
- 边界清晰,不易与其他 Skill 重叠
Areas to improve
-
文档较长,可考虑分章节更清晰 Reported severity: Minor
文档内容较丰富但较长,可考虑使用更清晰的章节划分或目录结构
Recommendation: 建议使用更清晰的章节标题和子标题,或添加目录导航
Highlights
- 结构清晰,包含多个逻辑章节
- 有详细的步骤划分和端到端示例
- frontmatter 完整,元数据齐全
Highlights
- 工具来源明确,参数正确
- 覆盖主要异常情况并提供排查方法
- 提供了常见问题的详细解决方案
The arithmetic mean of the first four original scores, rounded to a whole number.
Static text checks
100 / 100 · skillpi-20261123-no-r3-v1
No current rules matched the text.
This score reflects rule matches in the text and is provided for reference before use. It excludes attachments and runtime behavior.
Permissions and checks before use
Automatically summarized from this main document. Matches may be examples or defensive advice; they are not actual permission declarations. Attachments, external dependencies and runtime behavior are not covered.
-
Install or fetch external dependencies
Use official sources and pin versions. Check install scripts in an isolated environment. This document check does not cover code downloaded later.
Mentioned in main document · lines 51, 142
Domains or addresses referenced in the document
These addresses may be documentation links or examples, not an approved network allowlist. Verify actual destinations and outgoing data before use.
- github.com
- opencode.ai
Security rating and access scope
safe · Static evidence review; not a runtime safety guarantee.
Not specified in the source documentation.
Before use, confirm and authorize actual file access, external services and network destinations in your host. This review grants no runtime permissions.
User discussion
No verified reviews yet.