Installing Leiningen for use with Clojure
Asked Answered
F

7

16

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.

Falito answered 18/11, 2012 at 0:30 Comment(0)
T
18

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
    
Turenne answered 5/1, 2013 at 14:8 Comment(0)
T
3

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
Tegument answered 18/11, 2012 at 9:41 Comment(0)
F
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
Falito answered 18/11, 2012 at 21:49 Comment(0)
D
2

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.

Didache answered 18/11, 2012 at 2:50 Comment(0)
U
1

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.

Unshaped answered 18/11, 2012 at 19:6 Comment(0)
M
0

had the same issue make sure you update brew

$brew update

then

$brew install leiningen --devel
Margarethe answered 11/1, 2013 at 21:46 Comment(0)
K
0

For anyone wondering how to install a specific version of lein, an "easy" way to do so is by looking for the commit of the desired version on the install script https://github.com/technomancy/leiningen/blob/master/bin/lein

Download and run this script as your lein binary and it should just work. The actual version jar will be downloaded to ~/.lein/self-installs

Kutchins answered 10/11, 2021 at 15:22 Comment(1)
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 ReviewRelict

© 2022 - 2024 — McMap. All rights reserved.