Installing Leiningen for use with Clojure

12,693

Solution 1

An easier way of upgrading (if using homebrew) is to upgrade using homebrew and specify the version.

  1. Show available versions

     brew info leiningen
     leiningen: stable 1.7.1, devel 2.0.0-preview10, HEAD
    
  2. Install or upgrade to a specific version

    brew upgrade --devel leiningen
    ...
    /usr/local/Cellar/leiningen/2.0.0-preview10: 5 files, 80K, built in 10 seconds
    
  3. Use lein as normal

    lein version
    Leiningen 2.0.0-preview10 on Java 1.7.0_06 Java HotSpot(TM) 64-Bit Server VM
    

Solution 2

Check this guide: https://github.com/technomancy/leiningen/wiki/Upgrading

The trick is to download the script from the preview branch on the github repo:

# Make a backup of your previous lein
mv ~/bin/lein ~/bin/lein1
# Download preview version
wget -O ~/bin/lein https://raw.github.com/technomancy/leiningen/preview/bin/lein
# set permissions
chmod 755 ~/bin/lein

Solution 3

I found the issue. I had previously tried to install Leiningen via Homebrew, and the Homebrew lein command was somehow superseding the lein commands from the new version I had installed through the script.

I ran the command:

brew uninstall leiningen

Then I re-installed lein via the new lein script just be safe, first removing the following files & folders:

~/.lein
~/.m2
~/bin/lein

Now when I run lein version I get:

Leiningen 2.0.0-preview10 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM

Solution 4

There's constant LEIN_VERSION at the top of the lein script. Try changing it a more recent version (mine is 2.0.0-preview10), delete the leiningen jar in ~/.lein/self-installs/ and run lein self-install again.

Solution 5

To completely wipe out your existing Leiningen installation:

rm ~/bin/lein
rm -fr ~/.lein  # Though back up ~/.lein/profiles.clj if you have one.
rm -fr ~/.m2

then follow the "If you want a newer version it's still easy to install the old-fashioned way" instructions at http://leiningen.org/ .

Incidentally, if you happen to have a ~/bin/lein2 lying around, and have no need of any legacy lein 1.x (which, in your case, you don't), you can delete that ~/bin/lein2 file. You just want a ~/bin/lein going forward.

Share:
12,693
vramon
Author by

vramon

Updated on June 04, 2022

Comments

  • vramon
    vramon almost 2 years

    I'm trying to install Leiningen on my local machine to get Clojure running, but I can't seem to get the latest version.

    I'm following the instructions on github here: https://github.com/technomancy/leiningen

    I'm able to put the script in my path, and get Lein to download, but for some reason when I run lein version I keep getting

    Leiningen 1.7.1 on Java 1.6.0_33 Java HotSpot(TM) 64-Bit Server VM
    

    I've tried deleting and re-installing Leiningen several times, but nothing changes. Are there certain files I need to be deleting, or is there some way to switch versions? lein upgrade doesn't seem to do anything.

    Thanks in advance.

  • Bracken
    Bracken over 2 years
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review