Skip to content

Commit

Permalink
update installation instructions for Linux, Mac and Windows (#554)
Browse files Browse the repository at this point in the history
* update installation for Linux, Mac and Windows

Also included, by request, instructions for installing the Leiningen tool.

* explain leiningen briefly

* Provide info on text editor integrations

* fix code block

* link to clj-on-windows doc

Added a disclaimer that Clojure on Windows is still experimental.

* Update instructions on hello-world page

Included instructions for testing using the Clojure CLI.
  • Loading branch information
bobbicodes committed Jun 8, 2023
1 parent 4eda6c0 commit 26eece9
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 11 deletions.
63 changes: 56 additions & 7 deletions docs/INSTALLATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,24 @@
## Installing the Clojure CLI
Clojure provides command line tools that can be used to start a Clojure repl, use Clojure and Java libraries, and start Clojure programs.

If you need to install Java, we recommend [Adoptium Temurin 17](https://adoptium.net/).

### Linux
Ensure that the following dependencies are installed: `bash`, `curl`, `rlwrap`, and `Java`.
Ensure that the following dependencies are installed: `bash`, `curl`, `rlwrap`, and `Java`.
You can install Clojure either of these 2 ways:

1. LinuxBrew - requires [Homebrew](https://brew.sh/)

```bash
brew install clojure/tools/clojure
```

2. Script installer

```bash
curl -O https://download.clojure.org/install/linux-install-1.10.3.967.sh
chmod +x linux-install-1.10.3.967.sh
sudo ./linux-install-1.10.3.967.sh
curl -O https://download.clojure.org/install/linux-install-1.11.1.1347.sh
chmod +x linux-install-1.11.1.1347.sh
sudo ./linux-install-1.11.1.1347.sh
```

### Homebrew for Mac OS X
Expand All @@ -19,15 +30,32 @@ Install the command line tools with brew from the [clojure/tools](https://github
brew install clojure/tools/clojure
```

#### Java

Any distribution of Java will work. If needed, you can install Temurin using brew:

```bash
brew tap homebrew/cask-versions
brew install --cask temurin17
```

### Windows
For running Clojure on Windows it is recommended to use WSL2.

Clojure on Windows has improved significantly recently. We used to recommended using WSL2, which works great,
but there is now a PowerShell installer. Clojure on Windows is currently in an alpha state, see [clj-on-windows](https://github.com/clojure/tools.deps.alpha/wiki/clj-on-Windows#known-issues) for known issues.

Make sure Java is installed and the `JAVA_HOME` environment variable is set, and run:

```powershell
iwr -useb download.clojure.org/install/win-install-1.11.1.1165.ps1 | iex
```

Another way to install Clojure on Windows is with the [Scoop](https://scoop.sh/) package manager. To install scoop, open PowerShell and run these 2 commands, one after the other:

```sh
iwr -useb get.scoop.sh | iex
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
``
```

To install Clojure with Scoop you have to add two important buckets first:

Expand Down Expand Up @@ -61,4 +89,25 @@ After successfully running steps above, you should be able to run Clojure with t

```sh
clj
```
```

## Install Leiningen (optional)

While no longer necessary, we still support the full featured project management tool [Leiningen](https://leiningen.org/).
It offers a wide variety of helpful tasks like convenient testing, builds, and an improved REPL.

1. Download the [lein script](https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein) or [lein.bat](https://raw.githubusercontent.com/technomancy/leiningen/stable/bin/lein.bat) (Windows)
2. Place it on your `$PATH` where your shell can find it (eg. `/usr/local/bin/`)
3. Set it to be executable (`sudo chmod a+x /usr/local/bin/lein`)
4. Run `lein`.

## Editor integration

The best way to develop Clojure is with an editor-connected REPL. Plugins are available for the most popular editors/IDEs:

- Emacs: [CIDER](https://cider.mx/)
- IntelliJ: [Cursive](https://cursive-ide.com/)
- VSCode: [Calva](https://calva.io/)
- Vim: [Conjure](https://github.com/Olical/conjure)

See the [official docs](https://clojure.org/guides/editors) for more info.
11 changes: 7 additions & 4 deletions exercises/practice/hello-world/.docs/instructions.append.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,18 @@

## Project Structure

Clojure exercises in exercism use [leiningen](http://leiningen.org/) to configure and run your code
and use [leiningen standard directory structure](https://github.com/technomancy/leiningen/blob/master/doc/TUTORIAL.md#directory-layout).
Clojure exercises in exercism support the two most common tools for dependency management and testing, [leiningen](http://leiningen.org/) and the [Clojure CLI](https://clojure.org/guides/deps_and_cli).

You will find a test file named `hello_world_test.clj` inside `test` directory.
Write your code in `src/hello_world.clj`. It should use the namespace `hello-world` so that tests can pick it up.

## Running tests
### Running tests using the Clojure CLI

Run the tests using `lein test` command and make them pass:
```
$ clj -X:test
```

### Running tests using Leiningen

```
$ lein test
Expand Down

0 comments on commit 26eece9

Please sign in to comment.