Overview
Thesetup_claw.sh script automates the entire OpenClaw installation process on Android devices via Termux. It handles system dependencies, environment configuration, path patching, and service setup in six main stages.
This installation process takes 5-10 minutes depending on your device and network speed.
Prerequisites
Before running the setup script, ensure you have:- Termux from F-Droid (not Google Play Store)
- Termux:API app from F-Droid
- Stable internet connection
- At least 500MB of free storage
Running the Setup Script
Execute the automated installation with this one-liner:Installation Stages
The setup script performs six critical stages:Dependencies & System Preparation
Updates the system and installs all required packages:Installed packages:
setup_claw.sh:20-23
- nodejs-lts: JavaScript runtime for OpenClaw
- git: Version control
- build-essential: C/C++ compiler toolchain
- python, cmake, clang, ninja: Build system tools
- pkg-config, binutils: Development utilities
- termux-api: Hardware access (GPS, camera, sensors)
- termux-services: Background service management (runit)
- proot, tmux, nano: System utilities
Environment Variables Configuration
Fixes critical path issues by configuring temporary directory environment variables:Why this matters:Android/Termux doesn’t have access to the standard
setup_claw.sh:26-47
/tmp directory. This configuration redirects all temporary file operations to $PREFIX/tmp (typically /data/data/com.termux/files/usr/tmp), preventing “Permission Denied” errors.Node-GYP Workaround
Applies a critical fix for Node.js native module compilation:Purpose:Node-GYP (the Node.js native addon build tool) expects an Android NDK when running on Android. This dummy configuration prevents build crashes during OpenClaw’s installation by providing a placeholder NDK path.
setup_claw.sh:50-53
OpenClaw Installation
Installs OpenClaw globally via npm:This step typically takes 5-10 minutes as npm downloads and compiles all dependencies.
setup_claw.sh:56-58
Hardcoded Path Patching
Patches OpenClaw’s source code to use Termux-compatible paths:Critical for Android:OpenClaw’s default codebase assumes access to
setup_claw.sh:61-70
/tmp/openclaw, which doesn’t exist in Termux. This sed command replaces all instances with $PREFIX/tmp/openclaw, ensuring file operations work correctly.Service Setup
Configures OpenClaw as a persistent background service using runit:What this creates:
setup_claw.sh:73-118
- Service directory:
$PREFIX/var/service/openclaw - Run script: Starts the OpenClaw gateway with proper environment
- Log script: Captures all output to
$PREFIX/var/log/openclaw/current - Runit supervision: Ensures the service restarts if it crashes
The service is enabled but not started yet. You’ll start it manually after onboarding.
Post-Installation Output
After successful installation, the script displays important instructions:Next Steps
With the setup complete, you’re ready to proceed to the onboarding process:OpenClaw Onboarding
Configure OpenClaw and complete the initial setup