Skip to content

Installation

Requirements

  • Ruby: 2.7 or higher
  • SQLite3: For persistent blackboard memory (optional)
  • Redis: For high-performance persistence (optional)

Installing the Gem

From RubyGems

gem install kbs

Using Bundler

Add to your Gemfile:

gem 'kbs'

Then run:

bundle install

From Source

git clone https://github.com/madbomber/kbs.git
cd kbs
bundle install
rake install

Optional Dependencies

SQLite3 (Default Blackboard Backend)

gem install sqlite3

Or in your Gemfile:

gem 'sqlite3'

Redis (High-Performance Backend)

Install Redis server:

# macOS
brew install redis
brew services start redis

# Ubuntu/Debian
sudo apt-get install redis-server
sudo systemctl start redis

# Docker
docker run -d -p 6379:6379 redis:latest

Install Ruby Redis gem:

gem install redis

Or in your Gemfile:

gem 'redis'

Verification

Verify the installation:

require 'kbs'

puts "KBS version: #{KBS::VERSION}"
# => KBS version: 0.1.0

# Test basic functionality
engine = KBS::Engine.new
engine.add_fact(:test, value: 42)
puts "✓ KBS is working!"

Development Setup

For contributing or running tests:

git clone https://github.com/madbomber/kbs.git
cd kbs
bundle install

# Run tests
bundle exec rake test

# Run examples
bundle exec ruby examples/working_demo.rb

Troubleshooting

SQLite3 Installation Issues

On macOS with M1/M2:

gem install sqlite3 -- --with-sqlite3-include=/opt/homebrew/opt/sqlite/include \
  --with-sqlite3-lib=/opt/homebrew/opt/sqlite/lib

On Ubuntu/Debian:

sudo apt-get install libsqlite3-dev
gem install sqlite3

Redis Connection Issues

Check Redis is running:

redis-cli ping
# => PONG

Test connection from Ruby:

require 'redis'
redis = Redis.new(url: 'redis://localhost:6379/0')
redis.ping
# => "PONG"

Next Steps