Homebrew Formula for Terraphim AI
This page provides instructions for installing Terraphim AI using Homebrew on macOS and Linux.
Installation
Option 1: Install from Tap (Recommended)
Once published to a Homebrew tap, you can install with:
# Add the Terraphim AI tap
# Install Terraphim AI
Option 2: Install from Local Formula
For development or testing, you can install directly from the formula file:
# Clone the repository
# Install from local formula
What Gets Installed
The Homebrew formula installs the following components:
Binaries
- Server:
terraphim_servercommand-line tool - TUI:
terraphim-agentterminal user interface - Desktop App: "Terraphim Desktop.app" (macOS only)
Configuration
- Default configuration files in
/usr/local/etc/terraphim-ai/ - Includes role configurations for different user profiles
Documentation
- README and documentation files in
/usr/local/share/doc/terraphim-ai/
Usage
Server Mode
# Start the server
# Start with custom configuration
# View help
Terminal UI (TUI)
# Start the interactive terminal interface
# Use REPL mode with full features
# View available commands
Desktop App (macOS)
# Launch desktop application
Service Management
# Start as background service
# Stop the service
# View service status
| Configuration
Default configuration files are installed in /usr/local/etc/terraphim-ai/:
terraphim_engineer_config.json- Engineering role configurationsystem_operator_config.json- System operator role configuration
You can customize these files or create your own configurations.
Logs
When running as a service, logs are written to:
- Standard output:
/usr/local/var/log/terraphim-ai.log - Error output:
/usr/local/var/log/terraphim-ai-error.log
Uninstalling
# Stop the service (if running)
# Uninstall the package
# Remove the tap (optional)
Homebrew Formula
The complete Homebrew formula (terraphim-ai.rb):
desc "Privacy-first AI assistant with semantic search and knowledge graphs"
homepage "https://github.com/terraphim/terraphim-ai"
url "https://github.com/terraphim/terraphim-ai/archive/refs/tags/v0.1.0.tar.gz"
sha256 "0000000000000000000000000000000000000000000000000000000000000000" # Will need to be updated with actual SHA256
license "MIT"
head "https://github.com/terraphim/terraphim-ai.git", branch: "main"
depends_on "rust" => :build
depends_on "node" => :build
depends_on "yarn" => :build
depends_on "pkg-config" => :build
depends_on "openssl@3"
depends_on "sqlite"
# Build the Rust components
system "cargo", "build", "--release", "--bin", "terraphim_server"
# Build the desktop app (if on macOS)
if OS.mac?
cd "desktop" do
system "yarn", "install"
system "yarn", "run", "tauri", "build"
end
# Install the desktop app bundle
app_bundle = "target/release/bundle/macos/Terraphim Desktop.app"
if File.exist?(app_bundle)
prefix.install app_bundle => "Terraphim Desktop.app"
end
end
# Install the server binary
bin.install "target/release/terraphim_server"
# Install configuration files
(etc/"terraphim-ai").mkpath
(etc/"terraphim-ai").install Dir["terraphim_server/default/*.json"]
# Install documentation
doc.install "README.md"
doc.install "docs" if Dir.exist?("docs")
end
<<~EOS
Terraphim AI has been installed with the following components:
1. Server: Run with `terraphim_server`
2. Desktop App: Available in Applications folder (macOS only)
Default configuration files are located in:
/terraphim-ai/
For first-time setup:
1. Run `terraphim_server --help` to see available options
2. Configuration files can be customized in /terraphim-ai/
3. The desktop app will create its own config on first run
Documentation is available in:
/
EOS
end
service do
run opt_bin/"terraphim_server"
keep_alive true
error_log_path var/"log/terraphim-ai-error.log"
log_path var/"log/terraphim-ai.log"
working_dir HOMEBREW_PREFIX
end
test do
# Test that the server binary was installed and shows version info
system "/terraphim_server", "--version"
# Test that config files were installed
assert_predicate etc/"terraphim-ai", :exist?
# Test basic functionality by checking the help output
help_output = shell_output("/terraphim_server --help")
assert_match "Terraphim AI Server", help_output
end
endRequirements
Build Dependencies
- Rust (latest stable)
- Node.js (v16 or later)
- Yarn package manager
- pkg-config
Runtime Dependencies
- OpenSSL 3.x
- SQLite 3.x
Troubleshooting
Build Issues
- Rust not found: Ensure Rust is installed via
rustupor Homebrew - Node.js version: Requires Node.js v16 or later
- Missing dependencies: Run
brew doctorto check for system issues
Runtime Issues
- Config not found: Check
/usr/local/etc/terraphim-ai/for configuration files - Permission errors: Ensure proper file permissions for log directory
- Port conflicts: Default server port may conflict with other services
Getting Help
- Check the logs in
/usr/local/var/log/terraphim-ai*.log - Run
terraphim_server --helpfor command-line options - Refer to the main documentation in
/usr/local/share/doc/terraphim-ai/
Publishing to Homebrew
To publish this formula to Homebrew:
- Create a release on GitHub with proper version tagging
- Calculate SHA256 of the release archive
- Update the formula with the correct URL and SHA256
- Submit to homebrew-core or create your own tap
For detailed instructions on creating Homebrew formulae, see the Homebrew Formula Cookbook.