Search code examples
clojureleiningen

Leiningen not working MacOs Mojave due to Caused by: java.io.FileNotFoundException: Could not locate clojure/tools/nrepl/server__init.class


I am on Mojave and can't get leiningen to work.

I was using java 8, and then tried upgrading to 11 to no avail. Currently using:

openjdk version "11.0.7" 2020-04-14
OpenJDK Runtime Environment AdoptOpenJDK (buildb11.0.7+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.7+10, mixed mode)

I have tried copying lein to my /usr/local/bin and brew install but in both cases I get the error:

Caused by: java.io.FileNotFoundException: Could not locate clojure/tools/nrepl/server__init.class, clojure/tools/nrepl/server.clj or clojure/tools/nrepl/server.cljc on classpath.

Solution

  • I had a similiar problem recently on macOS Mojave (10.14.6). The following command did the trick for me:

    rm -rf .lein
    

    However, before you run this line, please make sure that...

    1. ... you are in your home directory.
    2. ... .lein is a directory associated with your leiningen installation and nothing else!
    3. ... that you have a backup of any config files, custom packages, etc. that are associated with your leiningen installation.

    Once you hit enter the .lein directory will be deleted. The directory will be rebuild when you start the repl via leinigen lein repl.