LinuxCommandLibrary

bb

Native Clojure interpreter for scripting

TLDR

Build Clojure project

$ bb [script.clj]
copy
Run REPL
$ bb repl
copy
Execute expression
$ bb -e ["(println (+ 1 2 3))"]
copy
Install task runner
$ bb tasks
copy

SYNOPSIS

bb [options] [file] [args]

DESCRIPTION

bb (Babashka) is a native Clojure interpreter for scripting. It provides fast startup times and can run Clojure scripts without JVM overhead, making it suitable for shell scripting and task automation.
The tool enables using Clojure for tasks typically handled by bash or Python scripts.

PARAMETERS

-e, --eval expr

Evaluate expression
-f, --file file
Run file
-m, --main ns
Call main function in namespace
--repl
Start REPL
--nrepl-server
Start nREPL server
--classpath cp
Set classpath
--uberscript file
Create standalone script

CONFIGURATION

bb.edn

Project configuration file for tasks, dependencies, and classpath settings.

FEATURES

- Fast startup (milliseconds)
- Most of Clojure core
- Common libraries included
- Task runner (bb.edn)
- Pod system for native bindings
- Compatible with Clojure syntax
- Shell out capabilities

TASK RUNNER

Define tasks in bb.edn:

$ {:tasks
 {test {:doc "Run tests"
        :task (shell "clojure -M:test")}}}
copy

CAVEATS

Not full Clojure (some features missing). Not as fast as compiled code. Limited Java interop. Some libraries don't work. Pods add complexity.

HISTORY

Babashka was created by Michiel Borkent in 2019 to enable fast Clojure scripting without JVM startup overhead.

SEE ALSO

clojure(1), lein(1), janet(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community