Fork me on GitHub

A few people have reported that Cursive can’t connect to the babashka REPL, because it tries to do some things (mostly around completion) that aren’t supported. Is there any way that I can detect on connection that I’m connected to babashka and not Clojure? Is there a *babashka-version* var or anything like that?


I was about to suggest a workaround to make cursive chill out about the remote process, but then I noticed who’s the author of the question 😄


Haha, I’m interested in workarounds too 🙂

vlaaad07:07:04 create local repl configuration (using clojure.main) that calls tubular main that connects to remote repl


Oh right, and using a socket REPL.


cursive thinks it’s local repl and just sends forms to it, while in reality we pipe those forms from dummy jvm process to our remote target


If I can detect that I’m connecting to babashka, then I can make Cursive’s socket REPL work with it too.


I think @borkdude did something related to reader conditionals


like support for #?(:bb "I'm in bb!") or something…


Looks like I could also test for the presence of some of the babashka namespaces too, like babashka.classpath.


ah, maybe you need to enable that explicitly…


Yeah, I see that in the doc. So something like (def babashka? #?(:bb true :clj false))


There's also a system property to check the babashka version: To sum up, you can do this with reader conditionals, check for babashka.classpath namespace or check the system property, all valid ways


Got the Windows build for bb working on my dev machine:

PS C:\Users\borkdude> Measure-Command { bb -e "(+ 1 2 3)"  | Out-Default }

Days              : 0
Hours             : 0
Minutes           : 0
Seconds           : 0
Milliseconds      : 23
Ticks             : 236056
TotalDays         : 2.73212962962963E-07
TotalHours        : 6.55711111111111E-06
TotalMinutes      : 0.000393426666666667
TotalSeconds      : 0.0236056
TotalMilliseconds : 23.6056

👍 6

PS C:\Users\borkdude> bb -e "(System/getProperty \`"\`")"
"Windows 10"


Hi - just a small thing, perhaps worth noting? In the first example on the babashka github website, here ls | bb -i '(filter #(-> % io/file .isDirectory) *input*)', that will return () (I was wondering why, did I break something - yes sorta) - it's because ls is aliased in my shell


❯ which ls        
ls: aliased to ls --color=always


❯ ls | bb -i '(filter #(-> % io/file .isDirectory) *input*)'


this, works naturally, if one uses the full path /usr/bin/ls | bb -i '(filter #(-> % io/file .isDirectory) *input*)'


So, perhaps a little gotcha that may throw some people trying out bb for the first time 🙂


Maybe a different example from ls would be even better.


Well, it still can be used, if it is escaped 🙂


i.e., \ls ..... or "ls" ....


that will ensure anyone who has aliased ls, when running the example, will force the unaliased version to be used 🙂


It's a good example, quick and easy, just a little gotcha.


i would really like to see an up to date babashka version accessible via the nix package manager (, which works on both macOS and linux. if anyone else is into using nix or wants to get into it, im more than happy to hop on a screen sharing session and demo how im using it or i can help to debug issues on your setup. (the documentation is a bit hidden on that download page under the More... tab, so here is a direct link, if you want to give it a quick try: it won't interfere with your system at all, because it puts everything under a /nix/ directory, so don't worry about trying it out.)


Following on from my question yesterday, is there a reliable way to tell that a particular file is intended for babashka? Obviously I could look for the shebang and try to work out if it indicates bb, but that might not always be there. babashka scripts will probably need special handling in Cursive.


Is it common to write babashka scripts that are also intended to be used as plain Clojure?


> is there a reliable way to tell that a particular file is intended for babashka? I don't think so, because it seems like he is trying to make more and more Clojure libraries just work as is

Adrian Smith21:07:50

Is it possible to use babashka with honeysql I've tried: bb -f hello.clj -cp \"(clojure -Sdeps '{:deps {honeysql {:mvn/version "1.0.444"}}}' -Spath)\" but when I try and require (require '[honeysql.format :refer :all]) it says "Could not require honeysql.format"

Adrian Smith21:07:09

*command-line-args* prints (-cp "src:/Users/adriansmith/.m2/repository/org/clojure/clojure/1.10.1/clojure-1.10.1.jar:/Users/adriansmith/.m2/repository/honeysql/honeysql/1.0.444/honeysql-1.0.444.jar:/Users/adriansmith/.m2/repository/org/clojure/spec.alpha/0.2.176/spec.alpha-0.2.176.jar:/Users/adriansmith/.m2/repository/org/clojure/core.specs.alpha/0.2.44/core.specs.alpha-0.2.44.jar")


Yes, honeysql does work with babashka. Also this works on my machine:

bb -f hello.clj -cp "$(clojure -Sdeps '{:deps {honeysql {:mvn/version "1.0.444"}}}' -Spath)"


Your shell syntax looks slightly different.

Adrian Smith09:07:11

yeah I use fish by default, it seems like using bash makes no difference:


Can you print what bb --version gives?

Adrian Smith10:07:59

babashka v0.0.25 ah that definitely doesn't seem right


probably an old version on the path

Adrian Smith10:07:33

yep brew link cleared that up thank you


Yeah I’m having a similar problem. I have a deps project with 1 dependency;

hickory                      {:mvn/version "0.7.1"}
And my script contains one line: `
(ns parse (:require [hickory.core :as hickory]))
And I run the script as such:
bb --classpath $(clojure -Spath) -m parse
clojure.lang.ExceptionInfo: Unable to resolve classname: org.jsoup.Jsoup [at hickory/core.clj, line , column ]
So the hickory dependency is visible, but its dependency isn’t. I’ve checked the clojure -Spath output and I see that Jsoup jar is in the classpath… I am at a loss at what I’m doing wrong. babashka v0.1.3


@U66G3SGP5 That's a different problem. You can't run arbitrary deps with babashka, especially not those who bring in Java dependencies


Take a look here of what's tested: If you want hickory/Jsoup-ish stuff, take a look at the babashka pods, also listed there.