vramon
vramon

Reputation: 596

Installing Leiningen for use with Clojure

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.

Upvotes: 16

Views: 13884

Answers (7)

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

Upvotes: 0

marknery
marknery

Reputation: 1543

had the same issue make sure you update brew

$brew update

then

$brew install leiningen --devel

Upvotes: 0

Stuart McConnell
Stuart McConnell

Reputation: 665

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
    

Upvotes: 18

uvtc
uvtc

Reputation: 720

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.

Upvotes: 1

vramon
vramon

Reputation: 596

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

Upvotes: 3

Jean-Louis Giordano
Jean-Louis Giordano

Reputation: 1967

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

Upvotes: 3

tungd
tungd

Reputation: 14897

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.

Upvotes: 2

Related Questions