简体   繁体   中英

cannot install lein (Leiningen) for Clojure on macOS Catalina (10.15)

I've been unable to install Leiningen on macOS 10.15; I've followed the install instructions at leiningen.org.

The error I get is

gw@MacBook-Pro bin % sh lein
Error: -classpath requires class path specification

My classpath is

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Users/gw/usr/bin

and the lein install script (from leiningen.org) is in /Users/gw/usr/bin

Could the problem be leftover dirs/files from previous installations of lein?

My Macbook Pro is fairly new (< 1 year). Could it be that I don't have some software or package that's needed somewhere?

I've been banging about the Internet and the CLI for several hours and can't find a solution. Thanks in advance for your help.

I presume in your question above, you meant shell path and not classpath, and your PATH environment variable is set to what you showed in your question. If you installed lein as per the instructions, you should not need sh lein . Just lein should work.

I presume you've installed the lein from leiningen.org into /Users/gw/usr/bin and that it is executable.

Make sure that the new lein is in your path. See what which lein says. Does it point to the new lein ? If you had a different version of lein installed via brew , it might be in /usr/local/bin which is first in your PATH .

Is java installed on your Macbook? Try java -version and see that it returns what you expect.

Make a new empty directory and cd to it. Then run lein . It should show you the usage, if all is okay.

I don't know why this worked, but it did. I'm posting this because it may be a clue to someone who reads this.

Solution: I deleted the "empty" directory structure that I had created early (ie, lein new foo ) and recreated it from scratch ( lein new foo ). Everything worked fine.

My best guess as to why this worked is that I had created the old foo directory structure under an old version of lein (ie, before I reinstalled lein ), and something must have been different after I reinstalled lein . Your explanation may vary;)

brew install leiningen
lein

RIF. https://formulae.brew.sh/formula/leiningen#default

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM