Installation
This guide covers installing Cactus on all supported platforms, including macOS, Linux, iOS, and Android.System Requirements
macOS
- OS: macOS 13.0+ (Ventura or later)
- CPU: Apple Silicon (M1+) recommended, Intel supported
- RAM: 2GB minimum, 4GB recommended
- Disk: 500MB for Cactus + 200-500MB per model
- Tools: Homebrew (for package install) or Xcode Command Line Tools (for source)
Linux
- OS: Ubuntu 20.04+, Debian 11+, or compatible
- CPU: ARM64 or x86_64 (ARM64 recommended for performance)
- RAM: 2GB minimum, 4GB recommended
- Disk: 500MB for Cactus + 200-500MB per model
- Tools:
python3.12,cmake,build-essential,libcurl4-openssl-dev
iOS
- OS: iOS 14.0+
- Device: iPhone 6s or later (A9 chip+)
- RAM: 1GB+ available (depends on model size)
- Development: Xcode 14.0+, Swift 5.7+
Android
- OS: Android API 24+ (Android 7.0+)
- Architecture: arm64-v8a (64-bit ARM)
- RAM: 1GB+ available (depends on model size)
- Development: Android Studio, Kotlin 1.9+
macOS Installation
Option 1: Homebrew (Recommended)
The fastest way to install on macOS:- Cactus CLI tool (
cactus) - Pre-built libraries (
libcactus.a) - Header files for C/C++ integration
Option 2: Source Build
For development or custom builds:setup script will:
- Configure git hooks for DCO (Developer Certificate of Origin)
- Create a Python 3.12 virtual environment in
venv/ - Install Python dependencies from
python/requirements.txt - Install the
cactusCLI tool in editable mode
The
setup script must be sourced (not executed) to activate the virtual environment:Linux Installation
Install Dependencies
Ubuntu/Debian:Build from Source
Configure Git Identity (Optional)
If you plan to contribute, configure your git identity:iOS Installation
Step 1: Build XCFramework
From the Cactus source directory:apple/cactus-ios.xcframework/- iOS framework (device + simulator)apple/cactus-macos.xcframework/- macOS frameworkapple/libcactus-device.a- Static library for iOS deviceapple/libcactus-simulator.a- Static library for iOS simulator
Step 2: Integrate into Xcode Project
Option A: XCFramework (Recommended)
- Drag
cactus-ios.xcframeworkinto your Xcode project - In your app target settings, go to “General” → “Frameworks, Libraries, and Embedded Content”
- Ensure
cactus-ios.xcframeworkis set to “Embed & Sign” - Copy
apple/Cactus.swiftinto your project
Option B: Static Library
- Add
libcactus-device.ato “Link Binary With Libraries” in Build Phases - Create a folder with
cactus_ffi.handmodule.modulemap - Add to Build Settings:
- “Header Search Paths” → path to header folder
- “Import Paths” (Swift) → path to module folder
- Copy
apple/Cactus.swiftinto your project
Step 3: Download Models
Models must be bundled with your app or downloaded at runtime:Step 4: Use in Swift
Android Installation
Step 1: Build Shared Library
From the Cactus source directory:android/build/lib/libcactus.so.
Step 2: Integrate into Android Project
For Android-only Apps
- Copy
libcactus.sotoapp/src/main/jniLibs/arm64-v8a/ - Copy
android/Cactus.kttoapp/src/main/java/com/cactus/
For Kotlin Multiplatform
-
Copy source files:
Cactus.common.kt→shared/src/commonMain/kotlin/com/cactus/Cactus.android.kt→shared/src/androidMain/kotlin/com/cactus/Cactus.ios.kt→shared/src/iosMain/kotlin/com/cactus/cactus.def→shared/src/nativeInterop/cinterop/
-
Copy binaries:
libcactus.so→app/src/main/jniLibs/arm64-v8a/
-
Update
build.gradle.kts:
Step 3: Download Models
On your development machine:app/src/main/assets/ and copy to internal storage at runtime.
Step 4: Use in Kotlin
SDK-Specific Setup
Python SDK
Python bindings are installed automatically withsource ./setup.
To rebuild Python bindings:
Swift SDK
Build for all Apple platforms:cactus-ios.xcframework- iOS (device + simulator)cactus-macos.xcframework- macOSlibcactus-device.a- iOS device static liblibcactus-simulator.a- iOS simulator static lib
Kotlin SDK
Build for Android:android/build/lib/libcactus.so
See the Kotlin SDK Guide for integration instructions.
Flutter SDK
Build for all platforms:Rust SDK
Rust bindings usebindgen to generate FFI wrappers from C headers.
See rust/README.md for setup instructions.
Downloading Models
CLI Download
Download models using the CLI:weights/<model-name>/.
Available Precisions
| Precision | Size | Speed | Quality | Use Case |
|---|---|---|---|---|
| INT4 | ~150MB | Fastest | Good | Default, mobile devices |
| INT8 | ~300MB | Fast | Better | When RAM is available |
| FP16 | ~600MB | Slower | Best | Required for some models (Moonshine) |
Moonshine models require FP16 precision:
Model Locations
Models are stored in:- macOS/Linux:
./weights/(relative to repo root) - iOS: App bundle or Documents directory
- Android: External storage or app-specific directory (
/sdcard/cactus/models/)
Cloud API Setup (Optional)
Cactus supports automatic cloud handoff when on-device confidence is low. Set your Cactus Cloud API key:~/.cactus/auth.
Check status:
Cloud handoff is optional. Cactus works fully offline without an API key.
Testing Installation
Run the built-in test suite:Building for Production
iOS Release Build
- Product → Archive
- Distribute App → App Store Connect
- Upload to TestFlight or App Store
Android Release Build
- Ensure
libcactus.sois inapp/src/main/jniLibs/arm64-v8a/ - Build release APK or AAB:
- Sign and upload to Google Play Console
Troubleshooting
macOS: “command not found: cactus”
Linux: “python3.12: command not found”
iOS: “dyld: Library not loaded”
Ensure XCFramework is set to “Embed & Sign” in:- Target → General → Frameworks, Libraries, and Embedded Content
Android: “java.lang.UnsatisfiedLinkError”
Ensurelibcactus.so is in the correct location:
“Failed to initialize model”
Check:- Model path is correct (use absolute paths)
- Model was fully downloaded:
- Sufficient RAM available (close other apps)
- Correct precision for model (Moonshine requires FP16)
Build Errors
Next Steps
Run Your First Inference
Follow the Quickstart to run your first model.
Explore the API
Read the Engine API Reference for all available functions.
Advanced Features
Learn about Tool Calling, RAG, and Embeddings.
Additional Resources
For issues or questions, please open an issue on GitHub or ask in the Reddit community.