Skip to content

Install the CLI

hakocms-cli is a single executable. Download it, extract it, and put it in a folder on your PATH, and you can use it.

OS CPU File
Linux (any distribution) x86_64 hakocms-cli-v<version>-x86_64-unknown-linux-musl.tar.gz
Linux aarch64 (arm64) hakocms-cli-v<version>-aarch64-unknown-linux-musl.tar.gz
macOS Apple silicon (M1 or later) hakocms-cli-v<version>-aarch64-apple-darwin.tar.gz
macOS Intel hakocms-cli-v<version>-x86_64-apple-darwin.tar.gz
Windows 10 or later x86_64 hakocms-cli-v<version>-x86_64-pc-windows-gnu.zip

The files are at https://download.hakocms.net/hakocms-cli/v<version>/. The latest version number, and the URL and SHA-256 of each file, are in the following file.

https://download.hakocms.net/hakocms-cli/latest.json

To download in a browser, go to CLI download on the product site. It lists the files of the latest version with their SHA-256.

Run the following command in a terminal.

ターミナルウィンドウ
curl -fsSL https://www.hakocms.net/install.sh | sh

If you see the following, it is installed. <version> is the version number you installed (such as 0.1.8), and <target> is the name of the OS and CPU (such as aarch64-apple-darwin).

hakocms-cli v<version>(<target>)をダウンロードしています
<home>/.local/bin/hakocms-cli に置きました

<home> is your home folder (such as /home/hako or /Users/hako).

This command downloads the latest version, checks with SHA256SUMS that the file is not corrupted, and then puts it at ~/.local/bin/hakocms-cli. You do not need administrator privileges (sudo). If ~/.local/bin is not on your PATH, the command shows a line to add to your shell configuration file. Add that line to ~/.zshrc or ~/.bashrc, and open a new terminal.

To read the script before you run it, open install.sh.

To change the install location or the version, put environment variables before sh.

Environment variable Meaning Default
HAKOCMS_CLI_INSTALL_DIR Install location ~/.local/bin
HAKOCMS_CLI_VERSION Version to install (such as 0.1.8) The latest version

For example, to put it in /usr/local/bin, do the following.

ターミナルウィンドウ
curl -fsSL https://www.hakocms.net/install.sh |
sudo HAKOCMS_CLI_INSTALL_DIR=/usr/local/bin sh

You can also install it by running the commands one at a time. The following steps download the latest version, check that the file is not corrupted, and then put it in /usr/local/bin.

  1. Choose the target for your OS and CPU.

    ターミナルウィンドウ
    # Linux (x86_64)
    TARGET=x86_64-unknown-linux-musl
    # Linux (arm64): aarch64-unknown-linux-musl
    # macOS (Apple silicon): aarch64-apple-darwin
    # macOS (Intel): x86_64-apple-darwin

    If you are not sure which one, run uname -sm. It shows one of Linux x86_64, Linux aarch64, Darwin arm64 (Apple silicon), or Darwin x86_64 (Intel).

  2. Look up the latest version number.

    ターミナルウィンドウ
    VERSION=$(curl -fsSL https://download.hakocms.net/hakocms-cli/latest.json |
    sed -n 's/.*"version": *"\([^"]*\)".*/\1/p')
    echo "$VERSION"

    A version number such as 0.1.8 is shown.

  3. Download the file and SHA256SUMS, which you use to verify it.

    ターミナルウィンドウ
    BASE=https://download.hakocms.net/hakocms-cli/v$VERSION
    NAME=hakocms-cli-v$VERSION-$TARGET
    curl -fsSLO "$BASE/$NAME.tar.gz"
    curl -fsSLO "$BASE/SHA256SUMS"
  4. Check that the file is not corrupted.

    ターミナルウィンドウ
    # Linux
    grep " $NAME.tar.gz\$" SHA256SUMS | sha256sum -c -
    # macOS
    grep " $NAME.tar.gz\$" SHA256SUMS | shasum -a 256 -c -

    If hakocms-cli-v<version>-<target>.tar.gz: OK is shown, the file is not corrupted. If FAILED is shown, download it again.

  5. Extract it and put it in /usr/local/bin.

    ターミナルウィンドウ
    tar xzf "$NAME.tar.gz"
    sudo install "$NAME/hakocms-cli" /usr/local/bin/

    If you do not have administrator privileges, put it in your own folder (mkdir -p ~/.local/bin && install "$NAME/hakocms-cli" ~/.local/bin/). If ~/.local/bin is not on your PATH, add export PATH="$HOME/.local/bin:$PATH" to your shell configuration file.

Besides hakocms-cli, the extracted folder contains the license (LICENSE), the licenses of other software it includes (THIRD_PARTY_LICENSES), and README.txt.

hakocms-cli is not signed by Apple. If you download the file in a browser and open and extract it in Finder, macOS marks the extracted file to block it from running. When you run that hakocms-cli, macOS shows a warning and stops it. In that case, remove the mark with the following command.

ターミナルウィンドウ
xattr -d com.apple.quarantine /usr/local/bin/hakocms-cli

If you installed with the one-line command, downloaded with curl as in the steps above, or extracted with tar in a terminal, the mark is not added, so you do not need this command.

In PowerShell, do the following.

  1. Download the latest version.

    ターミナルウィンドウ
    $latest = Invoke-RestMethod https://download.hakocms.net/hakocms-cli/latest.json
    $asset = $latest.assets.'x86_64-pc-windows-gnu'
    Invoke-WebRequest $asset.url -OutFile $asset.name
  2. Check that the file is not corrupted.

    ターミナルウィンドウ
    (Get-FileHash $asset.name -Algorithm SHA256).Hash.ToLower() -eq $asset.sha256

    If True is shown, the file is not corrupted.

  3. Extract it and put it in a folder on your PATH.

    ターミナルウィンドウ
    Expand-Archive $asset.name -DestinationPath .
    $dir = "$env:LOCALAPPDATA\Programs\hakocms-cli"
    New-Item -ItemType Directory -Force $dir | Out-Null
    Copy-Item "$($asset.name -replace '\.zip$','')\hakocms-cli.exe" $dir
  4. Add that folder to your PATH (only the first time you install).

    ターミナルウィンドウ
    $path = [Environment]::GetEnvironmentVariable("Path", "User")
    [Environment]::SetEnvironmentVariable("Path", "$path;$dir", "User")

    The updated PATH is available in PowerShell windows you open after this.

Open a new terminal and run the following command.

ターミナルウィンドウ
hakocms-cli version

If a version number is shown as follows, it is installed. <version> is the version number you installed (such as 0.1.8).

hakocms-cli <version> (Admin API 1)

If command not found is shown, the folder you put it in is not on your PATH.

Next, log in (Log in with the CLI).

(Optional) Let the Tab key complete commands and flags. Run the one for your shell, and open a new terminal.

ターミナルウィンドウ
# zsh
hakocms-cli completion zsh > "${fpath[1]}/_hakocms-cli"
# bash
mkdir -p ~/.local/share/bash-completion/completions
hakocms-cli completion bash > ~/.local/share/bash-completion/completions/hakocms-cli
# fish
hakocms-cli completion fish > ~/.config/fish/completions/hakocms-cli.fish

In PowerShell, add hakocms-cli completion powershell | Out-String | Invoke-Expression to your profile ($PROFILE).

To move to a new version, repeat the same steps you used to install. If you installed with the one-line command, run the same command again. The manual install steps also look up the latest version from latest.json, so you can use them as they are without editing. If you put the file in the same place, it replaces the old one. Your login information and settings keep working.

hakocms-cli version shows your current version. Step 2 of “Install manually” for Linux and macOS shows the latest version (on Windows, $latest.version after step 1).

  1. If you are logged in, log out first. This revokes the access token.

    ターミナルウィンドウ
    hakocms-cli auth logout
  2. Delete the executable. If you installed with the one-line command, run rm ~/.local/bin/hakocms-cli. If you installed manually, run sudo rm /usr/local/bin/hakocms-cli. On Windows, delete the %LOCALAPPDATA%\Programs\hakocms-cli folder.

  3. Delete the settings folder (~/.config/hakocms-cli; on Windows, %APPDATA%\hakocms-cli).