Welcome! Please see the About page for a little more info on how this works.

+1 vote
in Clojure by

I need help on how to install and use my Clojure on my Windows Operating system.

5 Answers

+1 vote
by

On Windows, it is very easy to manage Clojure CLI install with scoop.

https://github.com/littleli/scoop-clojure

+1 vote
by

Using WSL2 and installing Clojure inside Linux under WSL2 is probably ideal. If you learn to do it that way, it also means indirectly you're learning how to develop on Mac, Linux and Windows all at the same time, since the workflows will be the same between all three.

Alternatively, if you really don't want to go the WSL2 route, I recommend using https://github.com/borkdude/deps.clj

You can install it by running:

> PowerShell -Command "iwr -useb https://raw.githubusercontent.com/borkdude/deps.clj/master/install.ps1 | iex"

Then to use Clojure just type:

> deps.exe
Clojure 1.10.1
user=>

Just keep in mind every time you'll see in a guide or tutorial to use at the command line either clj or clojure in this case you have to substitute it for deps.exe.

0 votes
by
edited by

edit July 19, 2024: https://clojure.org/guides/install_clojure#_windows_instructions now recommends WSL2 + Linux (or the clj-msi community installer).

My personal recommendation is to install WSL2 (Windows Subsystem for Linux) and Ubuntu -- both from the Microsoft Store, assuming you're on Windows 11 or a recent Windows 10 -- and then you can just follow all the books/tutorials out there that assume macOS/Linux and you won't have to worry about weird quoting rules in Powershell or cmd.exe

VS Code has an official extension for working with WSL2 that lets you run VS Code on Windows with all your development setup on Ubuntu as if it were local. That's an easy way to work with Clojure on Windows (using Calva for Clojure integration).

0 votes
by

How I do it for Leiningen projects (works on Windows 7-11):

https://gist.github.com/nikolavojicic/6081284d4fb5f969a7fabe1f150db73e

0 votes
by

This is how i personally do it
I dont like to use tools like scoop or chocolatey, specially now since we dont really need them as winget exist

What I do is I download the last release from
https://github.com/clojure/brew-install/releases

because I am a bit paranoid, I always download the hash sha256 file and compare it vs the download file using this command

get-fileHash -Algorithm SHA256 .\clojure-tools.zip | select -ExpandProperty hash  >> .\clojure-tools.zip.sha256

if the sha256 matches , unzip the clojure tools files, in the module path for powershell
you can find out your module path by running this command

$env:psmodulePath -split ';'

Select one of those folders and unzip or extract clojure-tools.zip in it
this zip file have a ClojureTools folder in it, this is the folder you need to add to one of your PS Module path folders

Next go inside inside this folder and unblock this file ClojureTools.psm1
you can unblock from the file properties in the gui or from the command line using this command

 Unblock-File .\ClojureTools.psm1

Next Import the ClojureTools module using this command

Import-Module ClojureTools

If this import step fails it will be for one of two reasons

  1. You did not unblock the ClojureTools.psm1 file , or
  2. Your ExcecutionPolicy is not set to RemoteSigned

The install step does more or less the above steps except, the one about the file unblocking, I never tested it, as I dont like use install script, I like to check the sha256 hash myself and make sure its all good

...