Skip to content

CLI Installation

This guide covers installing and setting up the OstrichDB CLI on Unix-based systems (macOS and Linux). The CLI is written in Odin and provides a powerful terminal-based interface to OstrichDB.

Before installing the OstrichDB CLI, ensure your system meets these requirements:

  • Operating System: Unix-based system (macOS or Linux)
  • Memory: At least 512MB RAM available
  • Storage: 100MB+ free disk space
  • Terminal: Command-line interface access

The OstrichDB CLI requires Go to be installed and properly configured:

Installation:

  1. Visit https://go.dev/
  2. Download the appropriate version for your system
  3. Follow the installation instructions
  4. Recommended version: go1.23.1 or later

Verify Installation:

Terminal window
go version
# Should output: go version go1.23.1 [system] [arch]

PATH Configuration: Ensure Go is in your system PATH:

Terminal window
echo $PATH
# Should include Go's bin directory (usually /usr/local/go/bin)
# If not in PATH, add to your shell profile (.bashrc, .zshrc, etc.):
export PATH=$PATH:/usr/local/go/bin

OstrichDB is written in Odin, so the Odin compiler is required:

Installation:

  1. Visit https://odin-lang.org/
  2. Follow the Odin Installation Guide
  3. Recommended version: dev-2024-11:764c32fd3 or later

Quick Installation (Linux/macOS):

Terminal window
# Clone the Odin repository
git clone https://github.com/odin-lang/Odin.git
cd Odin
# Build Odin (Linux)
make release
# Build Odin (macOS)
make release_native
# Move to system PATH location
sudo mv odin /usr/local/bin/

Verify Installation:

Terminal window
odin version
# Should output version information

PATH Configuration: Ensure Odin is accessible from anywhere:

Terminal window
which odin
# Should output: /usr/local/bin/odin (or similar)
# If not found, add Odin to your PATH
export PATH=$PATH:/path/to/odin

This method builds OstrichDB directly on your system for optimal performance.

Terminal window
git clone https://github.com/Solitude-Software-Solutions/OstrichDB.git
cd OstrichDB
Terminal window
chmod +x scripts/local_build_run.sh
chmod +x scripts/local_build.sh
chmod +x scripts/restart.sh
Terminal window
# Build and immediately run OstrichDB
./scripts/local_build_run.sh

Alternative: Build Only

Terminal window
# Just build without running
./scripts/local_build.sh
# Then run manually
./main.bin

After building, you should see:

Terminal window
OstrichDB CLI v[version]
Welcome to OstrichDB!
Type 'HELP' for assistance.
OstrichDB>

For isolated environments or systems where dependencies are difficult to install.

  1. Install Docker: Visit https://docs.docker.com/engine/install/
  2. Verify Docker: docker --version
Terminal window
cd /path/to/OstrichDB
Terminal window
# Build the container
docker compose build
# Alternative: Build and run in detached mode
docker compose up -d
Terminal window
# Connect to the running container and start CLI
docker exec -it ostrichdb /app/main.bin

Port Mapping: The default Docker setup uses port 8080. To change this, edit docker-compose.yml:

# Change from default 8080 to 8089
ports:
- "8089:8080"

Data Persistence: OstrichDB data is stored in .ostrichdb/data on your host machine, mapped to /data in the container.

You should see the OstrichDB CLI prompt inside the container:

Terminal window
OstrichDB CLI v[version]
Welcome to OstrichDB!
Type 'HELP' for assistance.
OstrichDB>

After successful installation, perform initial setup:

Terminal window
# Start OstrichDB
./main.bin
# Create a user account
OstrichDB> NEW USER
# Follow the prompts to set up username and password
Terminal window
# Create test data
OstrichDB> NEW test.sample.hello OF_TYPE STRING WITH "Hello, OstrichDB!"
# Fetch the data
OstrichDB> FETCH test.sample.hello
# View data structure
OstrichDB> TREE
# Get help
OstrichDB> HELP
Terminal window
# Enable verbose help
OstrichDB> SET CONFIG HELP_IS_VERBOSE TO true
# Configure auto-server startup
OstrichDB> SET CONFIG AUTO_SERVE TO true
# Set session time limits
OstrichDB> SET CONFIG LIMIT_SESSION_TIME TO false

Set up optional environment variables for easier access:

Terminal window
# Add to your shell profile (.bashrc, .zshrc, etc.)
# OstrichDB installation path
export OSTRICHDB_HOME="/path/to/OstrichDB"
# Add OstrichDB to PATH for global access
export PATH="$PATH:$OSTRICHDB_HOME"
# OstrichDB data directory
export OSTRICHDB_DATA="$OSTRICHDB_HOME/.ostrichdb/data"

Reload your shell:

Terminal window
source ~/.bashrc # or ~/.zshrc

After installation, your OstrichDB directory structure will look like:

OstrichDB/
├── main.bin # Compiled executable
├── scripts/
│ ├── local_build.sh # Build script
│ ├── local_build_run.sh # Build and run script
│ └── restart.sh # Restart script
├── .ostrichdb/
│ ├── data/ # Database files (.ostrichdb)
│ ├── logs/ # System logs
│ ├── configs/ # Configuration files
│ └── backups/ # Database backups
├── src/ # Source code (Odin files)
├── docker-compose.yml # Docker configuration
└── README.md # Documentation
Terminal window
# Error: go: command not found
# Solution: Install Go and add to PATH
which go
echo $PATH
export PATH=$PATH:/usr/local/go/bin
Terminal window
# Error: odin: command not found
# Solution: Install Odin and add to PATH
which odin
# If not found, reinstall Odin or fix PATH
Terminal window
# Error: Permission denied when running scripts
# Solution: Make scripts executable
chmod +x scripts/*.sh
Terminal window
# Check dependencies are installed
go version
odin version
# Try rebuilding
./scripts/local_build.sh
# Check for error messages in output
Terminal window
# Docker daemon not running
sudo systemctl start docker # Linux
open -a Docker # macOS
# Permission issues
sudo docker compose build
# Or add user to docker group (Linux)
sudo usermod -aG docker $USER

Rosetta 2 (Apple Silicon):

Terminal window
# If running on Apple Silicon with Rosetta
arch -x86_64 ./scripts/local_build.sh

Xcode Command Line Tools:

Terminal window
# Install if missing
xcode-select --install

Missing Development Tools:

Terminal window
# Ubuntu/Debian
sudo apt update
sudo apt install build-essential git
# CentOS/RHEL/Fedora
sudo yum groupinstall "Development Tools"
# or
sudo dnf groupinstall "Development Tools"

Library Dependencies:

Terminal window
# If you encounter library errors
sudo apt install libc6-dev gcc # Ubuntu/Debian
sudo yum install glibc-devel gcc # CentOS/RHEL
Terminal window
# Use the build-and-run script for frequent testing
./scripts/local_build_run.sh
Terminal window
# Build optimized version
./scripts/local_build.sh
# Run with specific memory limits if needed
ulimit -m 1048576 # 1GB memory limit
./main.bin

If you encounter issues:

  1. Check Prerequisites: Ensure Go and Odin are properly installed
  2. Review Error Messages: Look for specific error details in output
  3. Check File Permissions: Ensure scripts are executable
  4. Verify System Resources: Ensure adequate memory and disk space
  5. Consult Documentation: Review the README and documentation
  6. Community Support: Join the OstrichDB community for help

After installation, verify everything works:

  • OstrichDB CLI starts without errors
  • Can create users with NEW USER
  • Can create and fetch records
  • TREE command shows data structure
  • HELP command provides information
  • VERSION shows correct version
  • Server mode works with SERVE (if needed)

With OstrichDB CLI installed:

  1. Learn Query Structure - Understand the CLP system
  2. Explore Commands - Master all available operations
  3. Configure Your Setup - Customize OstrichDB settings
  4. Try Examples - Practice with real-world scenarios

You’re now ready to start using OstrichDB CLI for your database management needs!