Crystal on OpenBSD 6.0

Not the most ideal way to install something on OpenBSD for various reasons. It will be great if there were packages already built for Crystal.


Install bash: doas pkg_add bash

OpenBSD comes with a default shell ksh. Crystal needs bash to run.

$ crystal
env: bash: No such file or directory

Installing the binary

Download the OpenBSD tarball from The latest version of Crystal available for OpenBSD is 0.19.4.

Extract it to where you store user downloaded binaries e.g. /usr/local or /opt

Link the binary to your path.

$ ln -sf /usr/local/crystal/bin/crystal /usr/local/bin/crystal

Making sure it works

Try running crystal to get the version:

$ crystal -v
Crystal 0.19.4 [7f82f79] (2016-10-07)

Create a Crystal program and run it.

def fibonacci(n)
  return n if n <= 1
  fibonacci(n - 1) + fibonacci(n - 2)
puts fibonacci 40
$ vim
$ crystal build --release
$ time ./fib
    0m00.94s real     0m00.81s user     0m00.01s system

It runs pretty fast on my OpenBSD server. OpenBSD is not particularly fast versus other operating systems, choosing a fast programming language helps speed things up.

Stanley Tan