An odd "IOException: Permission denied" after installing Leiningen

Just a quick heads-up (mostly for future me): if your freshly installed Leiningen complains about permissions, there’s a good chance that either the installer or lein itself simply didn’t create the .lein directory at the right time.

My setup was:

  • install SDKMAN
  • sdk install java
  • sdk install lein (2.12.0 in my case)
  • lein repl
  • observe the following:
java.io.IOException: Permission denied. Please check your access rights for /home/user/.lein/repl-port
 at leiningen.repl$repl.invokeStatic (repl.clj:460)
    leiningen.repl$repl.doInvoke (repl.clj:372)
    ...

Create the missing directory and have fun with your REPL (I certainly did with mine!):

user@host ~> mkdir ~/.lein
user@host ~> lein repl
nREPL server started on port 37731 on host 127.0.0.1 - nrepl://127.0.0.1:37731
REPL-y 0.5.1, nREPL 1.3.0
Clojure 1.12.2
OpenJDK 64-Bit Server VM 25.0.1+8-LTS
    Docs: (doc function-name-here)
          (find-doc "part-of-name-here")
  Source: (source function-name-here)
 Javadoc: (javadoc java-object-or-class-here)
    Exit: Control+D or (exit) or (quit)
 Results: Stored in vars *1, *2, *3, an exception in *e

user=>