Install clojure with leiningen on Ubuntu 13.04
Asked Answered
H

1

10

So I go to clojure.org/downloads and it says I can get clojure via leiningen. Great. I go to leiningen.org and think I'm following the instructions. It says to get their bash script and put it in your ~/bin/ Did it. Make it executable. Did it. ...then what? run the script? It doesn't say, but I did. This creates a .lein , which I suppose it should. Now what? How do I now install clojure? This is what clojure.org/downloads says:

Modify the dependencies and repositories sections of your Leiningen project.clj file, specifying the version of Clojure that you want:
; under dependencies, select the release of clojure
; (and optionally clojure-contrib) that you want
:dependencies [[org.clojure/clojure
                "1.5.0-alpha5"]]

but I have no idea what that means since I find no "project.clj" file anywhere. ~/.lein/self-installs has a monster leiningen-2.1.3-standalone.jar file, which probably doesn't want me hacking on it. What should I do now? How could I better inform myself in the future?

Hypnoanalysis answered 17/5, 2013 at 16:10 Comment(0)
S
11

At this point lein should be in your path. So, typing lein or lein help at your shell prompt should bring up the task list.

To create your first project

lein new my-first-project
cd my-first-project

You should then see a project.clj in that directory. Edit the dependencies in that file if you wish to have a different Clojure version than the default. Then just enter the REPL and any dependencies (including Clojure) should be downloaded and installed for you.

lein repl

As you your last question, I'd follow the tutorial on the leiningen website immediately after completing the installation instructions.

https://github.com/technomancy/leiningen/blob/stable/doc/TUTORIAL.md

Streamer answered 17/5, 2013 at 17:10 Comment(2)
I now understand that what I downloaded was lein itself, not an install script. So yes, the lein new my-first-project ran -- and running lein repl seemed to do some sort of downloading too ... of what? Is clojure now somewhere on my system?Hypnoanalysis
@user78162 The Clojure jar should now be in your maven repository, typically something like ~/.m2/org/clojure/.... Ordinarily you would not use the Clojure jar directly, but through lein. If you get a prompt from lein repl then you are ready to start learning Clojure interactively. Refer back to the tutorial on how to do builds.Streamer

© 2022 - 2024 — McMap. All rights reserved.