Summary: The ClojureBridge curriculum includes excellent instructions for installing Clojure on a variety of systems. They are well suited for beginners. I have adapted the Windows 8+ instructions for my recommendations.
If you’re looking for Windows 7 instructions, I’ve got those, too.
- Start a command prompt
- Get Java installed
- Get Leiningen installed
- Test installation
Starting a command prompt
For these instructions, you will need to have a command prompt open. This is a text-based interface to talk to your computer. Go to the "Windows" screen (the "Start Screen") and type "command". Choose the "Command Prompt" program, like in this screenshot:
When you choose "Command Prompt," your screen should look similar to this:
If you have never used the command prompt before, you may want to spend some time reading up on command prompt basics. For the rest of this setup, I will tell you to run commands in your command prompt. When I say that, I mean "type the command into the command prompt and press the Return key."
On other operating systems, the command prompt is called the terminal. We will use the terms terminal, command prompt, and command line interchangably.
Go to the Leiningen Windows installer site. You should see two links, one for installing Java and another for "leiningen-win-installer." Click the Java link. Then, you should see a screen like the following:
Click the button above "Java Platform (JDK)," as you can see in the above picture. Then you will come to a page that will have the following table on it:
Click the radio button to accept the license agreement, and then download one of the two Windows choices. If you are running 32-bit Windows, choose "Windows x86." If you are running 64-bit Windows, choose "Windows x64."
If you do not know if you are running 32-bit or 64-bit Windows, go to the "Windows" screen (the "Start Screen") and type "system." Choose "System." (If that does not work, type "Control Panel" and choose "System" from the Control Panel screen.) You should see a window like the following:
You should see if you are running 32- or 64-bit Windows beside "System Type."
Once you have downloaded the right Java version, run the executable you downloaded to install Java. Follow the installation wizard.
Leiningen is a tool used on the command line to manage Clojure projects.
Next, go back to the Leiningen Windows installer site and download the file linked as "leiningen-win-installer." Run this executable and follow the "Detailed installation" section at the Leiningen Windows Installer site. At the end of the installation, leave "Run a Clojure REPL" checked before you click "Finish." If a terminal window opens that looks like the one on the Leiningen Windows installer site, then you are good to go. If not, ask me for help.
Testing your setup
You have set up Java and Leiningen on your computer, all the tools you will need to run Clojure. Before starting, we need to test them out. Make sure you have a command prompt open for testing. We will just call this a terminal from now on.
Go to your terminal and run the following command:
This could take a long time, and will download many other pieces of code it relies on. You should see lines that start with
Retrieving ... on your screen. When it finishes, your terminal should look like the following:
This is starting a REPL, which we will learn about soon. It’s a special terminal for Clojure. At the REPL prompt, type
(+ 1 1) and hit enter. Did you get the answer
2 back? You will learn more about that in the course. For now, press the Control button and D button on your keyboard together (abbreviated as Ctrl+D). This should take you out of the Clojure REPL and back to your normal terminal prompt.
Congratulations! You have Clojure working on your machine!
These instructions have been adapated from the ClojureBridge Setup Guide, part of the ClojureBridge curriculum. ClojureBridge is an organization aimed at increasing the diversity of the Clojure community. They put on workshops around the world. You should support them by volunteering or donating.
ClojureBridge Curriculum by ClojureBridge is licensed under a Creative Commons Attribution 4.0 International License.