Skip to content
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
Cannot retrieve contributors at this time

Building babashka


  • Install lein for producing uberjars

  • Download GraalVM. Currently we use java19-22.3.1.

  • For Windows, installing Visual Studio 2019 with the "Desktop development with C++" workload is recommended.

  • Set $GRAALVM_HOME to the GraalVM distribution directory. On macOS this can look like:

    export GRAALVM_HOME=~/Downloads/graalvm-ce-java19-22.3.1/Contents/Home

    On linux:

    export GRAALVM_HOME=~/Downloads/graalvm-ce-java19-22.3.1

    On Windows, from the Visual Studio 2019 x64 Native Tools Command Prompt or cmd.exe (not Powershell):

    set GRAALVM_HOME=%USERPROFILE%\Downloads\graalvm-ce-java19-22.3.1

    If you are not running from the x64 Native Tools Command Prompt, you will need to set additional environment variables using:

    call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"

Clone repository

NOTE: the babashka repository contains submodules. You need to use the --recursive flag to clone these submodules along with the main repo.

$ git clone --recursive

To update later on:

$ git submodule update --init --recursive


Run the uberjar and compile script:

$ script/uberjar
$ script/compile

To configure max heap size you can use:

$ export BABASHKA_XMX="-J-Xmx6500m"

Note: setting the max heap size to a low value can cause the build to crash or take long to complete.

Alternative: Build inside Docker

To build a Linux version of babashka, you can use docker build, enabling the desired features via --build-arg like this:

docker build --build-arg BABASHKA_FEATURE_JDBC=true --target BASE -t bb-builder .
container_id=$(docker create bb-builder)
docker cp $container_id:/opt/bb bb # copy to ./bb on the host file system
docker rm $container_id

NOTE: If you get Error: Image build request failed with exit status 137 then check whether Docker is allowed to use enough memory (e.g. in Docker Desktop preferences). If it is, then increase the memory GraalVM can use, for example by adding --build-arg BABASHKA_XMX="-J-Xmx8g" (or whatever Docker has available, bigger than the default).


Run script\uberjar.bat followed by script\compile.bat.


To compile babashka as a static binary for linux, set the BABASHKA_STATIC environment variable to true.

Feature flags

Babashka supports the following feature flags:

Name Description Default
BABASHKA_FEATURE_CSV Includes the library true
BABASHKA_FEATURE_JAVA_NET_HTTP Includes commonly used classes from the package true
BABASHKA_FEATURE_JAVA_NIO Includes commonly used classes from the java.nio package true
BABASHKA_FEATURE_JAVA_TIME Includes commonly used classes from the java.time package true
BABASHKA_FEATURE_TRANSIT Includes the transit-clj library true
BABASHKA_FEATURE_XML Includes the library true
BABASHKA_FEATURE_YAML Includes the clj-yaml library true
BABASHKA_FEATURE_HTTPKIT_CLIENT Includes the http-kit client library true
BABASHKA_FEATURE_HTTPKIT_SERVER Includes the http-kit server library true
BABASHKA_FEATURE_CORE_MATCH Includes the clojure.core.match library true
BABASHKA_FEATURE_HICCUP Includes the hiccup library true
BABASHKA_FEATURE_TEST_CHECK Includes the clojure.test.check library true
BABASHKA_FEATURE_SPEC_ALPHA Includes the clojure.spec.alpha library (WIP) false
BABASHKA_FEATURE_JDBC Includes the next.jdbc library false
BABASHKA_FEATURE_SQLITE Includes the sqlite-jdbc library false
BABASHKA_FEATURE_POSTGRESQL Includes the PostgresSQL JDBC driver false
BABASHKA_FEATURE_ORACLEDB Includes the Oracle JDBC driver false
BABASHKA_FEATURE_DATASCRIPT Includes datascript false
BABASHKA_FEATURE_LANTERNA Includes clojure-lanterna false
BABASHKA_FEATURE_LOGGING Includes with taoensso.timbre as the default implementation true

Note that httpkit server is currently experimental, the feature flag could be toggled to false in a future release.

To disable all of the above features, you can set BABASHKA_LEAN to true.

Here is an example commit that can be used as a checklist when you want to create a new feature flag.


To compile babashka with the next.jdbc library and the embedded HyperSQL database:

$ script/uberjar
$ script/compile

Note: there is now a pod for working with HyperSQL.


To compile babashka with the next.jdbc library and a PostgresQL driver:

$ script/uberjar
$ script/compile

Note: there is now a pod for working with PostgreSQL.


To compile babashka with the babashka/clojure-lanterna library:

$ script/uberjar
$ script/compile

Example program:

(require '[lanterna.terminal :as terminal])

(def terminal (terminal/get-terminal))

(terminal/start terminal)
(terminal/put-string terminal "Hello TUI Babashka!" 10 5)
(terminal/flush terminal)