# Installing the standalone june

The standalone june is one executable with Bun built in, so it needs no Bun, Node or npm on your machine. It runs your projects' workflows with the june and React each project installs (see [Which june runs a command](https://june.dev/docs/cli.md#which-june-runs-a-command)), so a project still installs june as a dependency, and the standalone june never installs packages into it.

> **Not released yet.** The install URLs below are where June's releases and installer will be published: GitHub Releases in the public `johno/june-releases` repository, and `https://june.dev/install.sh`. Neither exists until the first release, so these commands fail until then. To try the standalone june now, build it from this repository with `make build:cli host=1` (see [Releasing](https://june.dev/docs/reference/releasing.md)).

## Install

macOS and Linux (glibc), arm64 or x64:

```sh
curl -fsSL https://june.dev/install.sh | bash
```

An exact version, or a release candidate:

```sh
curl -fsSL https://june.dev/install.sh | bash -s -- --version 0.2.0
curl -fsSL https://june.dev/install.sh | bash -s -- --version 0.3.0-rc.1
```

The script installs into `~/.june` (or `$JUNE_HOME`), without sudo, and adds `~/.june/bin` to your `PATH` in your shell's profile, once, between `# >>> june >>>` and `# <<< june <<<` lines. Pass `--no-modify-path` to leave your profile alone. It refuses to run as root unless `JUNE_ALLOW_ROOT=1`, for a container. Running it again reinstalls, or switches to the version you ask for.

It needs `curl`, `tar`, `shasum` or `sha256sum`, and `ssh-keygen` (OpenSSH, which macOS and most Linux distributions include), which it uses to verify the release's signature.

Windows x64 (Windows 10 1803 or later, for its `curl.exe` and OpenSSH) installs with PowerShell:

```powershell
irm https://june.dev/install.ps1 | iex
& ([scriptblock]::Create((irm https://june.dev/install.ps1))) -Version 0.2.0
```

It installs into `%USERPROFILE%\.june` and adds `.june\bin` to your user `PATH`, with the same checks, using Windows' own `curl.exe` and OpenSSH `ssh-keygen.exe`.

Then check it:

```sh
june --version
june doctor
```

## What the installer checks

Every release has a `manifest.json` listing each platform's archive with its exact size and SHA-256, and a `manifest.sig` signing it with June's release key. The install script and [`june upgrade`](https://june.dev/docs/cli.md#june-upgrade) both:

1. download the manifest and its signature from GitHub, over HTTPS only, following redirects only to GitHub's release asset hosts, and sending no credentials;
2. verify the signature with the release key built into the script (and into june) before trusting anything in the manifest;
3. download this platform's archive and check its size and SHA-256 against the signed manifest;
4. unpack exactly one file, `june`, refusing an archive with anything else in it;
5. run the new executable's `--version`, which must print the release's version;
6. only then make it the active version, by atomically switching `~/.june/current`.

A checksum alone isn't enough, since an attacker who could replace an archive could replace its checksum too; the signature is made with a key kept apart from the release repository. If any step fails, nothing changes, and an installed june keeps running.

## Upgrade, pin and roll back

```sh
june upgrade --check            # is a newer stable release out? changes nothing
june upgrade                    # install the latest stable release
june upgrade --version 0.2.0    # install exactly 0.2.0, older or newer
june rollback                   # back to the version you upgraded from
```

`june upgrade` never runs on its own. It takes GitHub's latest stable release, never a release candidate, unless you name a version. Only the active and previous versions are kept. See [`june upgrade`](https://june.dev/docs/cli.md#june-upgrade) and [`june rollback`](https://june.dev/docs/cli.md#june-rollback) for the details and their JSON output.

## Where it installs

```
~/.june/
  bin/june -> ../current/june          on your PATH
  current  -> versions/0.2.1/darwin-arm64
  previous -> versions/0.2.0/darwin-arm64
  versions/<version>/<platform>/june   with the manifest.json and manifest.sig it came from
```

Your projects' dependencies and June's per-project state (such as `.june/watch`) are separate from this directory. To uninstall, delete `~/.june` and the `# >>> june >>>` block from your shell profile.

## Without the install script

On a machine that can't run the script, download a release's `manifest.json`, `manifest.sig` and your platform's `june-<platform>.tar.gz` from its GitHub release, verify the signature yourself, unpack `june`, and let it install itself from those files:

```sh
echo 'june-release namespaces="june-release" <the release key from install.sh>' > allowed_signers
ssh-keygen -Y verify -f allowed_signers -I june-release -n june-release -s manifest.sig < manifest.json
tar -xzf june-darwin-arm64.tar.gz june
JUNE_HOME=~/.june ./june upgrade --from . --version 0.2.0 --install
```

`june upgrade --from <dir>` verifies the files again with the key built into june before installing them.

## Platforms

| Platform                | Archive                    | Status        |
| ----------------------- | -------------------------- | ------------- |
| macOS, Apple silicon    | `june-darwin-arm64.tar.gz` | Supported     |
| macOS, Intel            | `june-darwin-x64.tar.gz`   | Supported     |
| Linux x64, glibc        | `june-linux-x64.tar.gz`    | Supported     |
| Linux arm64, glibc      | `june-linux-arm64.tar.gz`  | Supported     |
| Windows x64             | `june-windows-x64.zip`     | Supported     |
| Linux with musl, Alpine | none                       | Not supported |

On an unsupported platform the installer and `june upgrade` say so rather than installing a near match. A project can still run june from its own `node_modules` with Bun.
