Skip to main content
The Harness CLI is distributed as a single binary with no external dependencies. Choose the installation method that works best for your environment. The fastest way to get started is using our installation script, which automatically detects your platform and installs the latest version.
curl -fsSL https://raw.githubusercontent.com/harness/harness-cli/v2/install | sh
The installation script automatically:
  • Detects your operating system and architecture
  • Downloads the appropriate binary
  • Verifies the checksum for security
  • Installs to /usr/local/bin (or your custom directory)
  • Makes the binary executable

Verify the installation

After installation, verify that hc is available:
hc version
You should see output similar to:
hc version 2.0.0
Built with go1.21.0

Manual installation

If you prefer to install manually or the quick install script doesn’t work for your environment, you can download the binary directly.
1

Download the binary

Visit the releases page and download the binary for your platform:
  • Linux (x86_64): hc-linux-amd64
  • Linux (ARM64): hc-linux-arm64
  • macOS (Intel): hc-darwin-amd64
  • macOS (Apple Silicon): hc-darwin-arm64
  • Windows (x86_64): hc-windows-amd64.exe
curl -LO https://github.com/harness/harness-cli/releases/latest/download/hc-linux-amd64
2

Make it executable

Rename the binary to hc and add execute permissions:
mv hc-* hc
chmod +x hc
3

Move to your PATH

Move the binary to a directory in your PATH:
sudo mv hc /usr/local/bin/
Or for a user-specific installation:
mkdir -p ~/.local/bin
mv hc ~/.local/bin/
# Add to PATH if needed
export PATH="$HOME/.local/bin:$PATH"
4

Verify the installation

hc version

Building from source

For development or if you need the absolute latest features, you can build the CLI from source.
Building from source requires Go 1.21 or later.
1

Install Go

If you don’t have Go installed, download it from go.dev/dl.Verify your Go installation:
go version
2

Clone the repository

git clone https://github.com/harness/harness-cli.git
cd harness-cli
3

Build the binary

Use the provided Makefile to build:
make build
This creates a hc binary in the current directory.
4

Install the binary

Move the built binary to your PATH:
sudo mv hc /usr/local/bin/
Or install to a custom location:
mv hc ~/.local/bin/
5

Verify the build

hc version

Development workflow

If you’re developing the CLI, you can use these additional commands:
make test

Platform-specific notes

Gatekeeper warning

On macOS, you may see a security warning when first running the CLI. This is because the binary is not signed with an Apple Developer certificate.To allow the CLI to run:
  1. Try to run hc in Terminal
  2. Go to System PreferencesSecurity & Privacy
  3. Click Allow Anyway next to the warning about hc
  4. Run hc again and click Open in the confirmation dialog
Alternatively, you can use:
sudo xattr -r -d com.apple.quarantine /usr/local/bin/hc

Installation directory

If /usr/local/bin is not in your PATH, you can either:
  1. Add it to your PATH in ~/.bashrc or ~/.zshrc:
    export PATH="/usr/local/bin:$PATH"
    
  2. Install to a directory that’s already in your PATH:
    mv hc ~/.local/bin/  # Usually in PATH by default
    

Permissions

If you get a “permission denied” error:
chmod +x /usr/local/bin/hc

PowerShell execution

  1. Download hc-windows-amd64.exe from the releases page
  2. Rename it to hc.exe
  3. Move it to a directory in your PATH (e.g., C:\Windows\System32 or C:\Users\YourName\bin)

Adding to PATH

If the installation directory is not in your PATH:
  1. Right-click This PCProperties
  2. Click Advanced system settings
  3. Click Environment Variables
  4. Edit the Path variable and add your directory
  5. Restart PowerShell or Command Prompt

Upgrading

To upgrade to the latest version, use the built-in upgrade command:
hc upgrade
The upgrade command automatically downloads and installs the latest version, preserving your configuration.
Alternatively, you can reinstall using any of the methods above.

Uninstalling

To uninstall the Harness CLI:
1

Remove the binary

sudo rm /usr/local/bin/hc
Or if you installed to a custom location:
rm ~/.local/bin/hc
2

Remove configuration (optional)

If you want to remove your saved authentication configuration:
rm -rf ~/.harness

Next steps

Now that you have the CLI installed, you’re ready to get started:

Quickstart guide

Get from installation to your first successful command in minutes.

Authentication

Learn how to authenticate with Harness services.

Configuration

Configure the CLI for your environment.

Command reference

Explore all available commands.

Build docs developers (and LLMs) love