Installation
Install the prebuilt binary or build Grafana CLI from source.
Install script (recommended)
Installs the latest prebuilt binary for your OS/arch. No Go toolchain is required:
curl -sSfL https://raw.githubusercontent.com/piyush-gambhir/grafana-cli/main/install.sh | shPin a version or change the install directory:
curl -sSfL https://raw.githubusercontent.com/piyush-gambhir/grafana-cli/main/install.sh | VERSION=0.2.7 sh
curl -sSfL https://raw.githubusercontent.com/piyush-gambhir/grafana-cli/main/install.sh | INSTALL_DIR=~/.local/bin shThe script installs to /usr/local/bin by default and asks for elevated
permissions when that directory is not writable.
Download a release manually
Prebuilt archives are attached to each
GitHub Release. Download
the archive for your OS and architecture, extract it, and put grafana on your
PATH:
# example (macOS arm64): adjust the asset name for your platform
curl -sSfL https://github.com/piyush-gambhir/grafana-cli/releases/latest/download/grafana-cli_darwin_arm64.tar.gz | tar xz
sudo mv grafana /usr/local/bin/The install script expects assets named grafana-cli_<os>_<arch>.tar.gz, where
<os> is darwin or linux and <arch> is amd64 or arm64.
Windows builds ship as grafana-cli_windows_amd64.zip containing grafana.exe.
The install script does not support Windows: extract grafana.exe from the
.zip and put it on your PATH. After that, grafana update keeps it current.
Build from source
Building locally requires Go:
git clone https://github.com/piyush-gambhir/grafana-cli.git
cd grafana-cli/cli-go
make installThe binary is grafana. make install writes it to go env GOBIN, or to
$(go env GOPATH)/bin when GOBIN is unset.
Updating
grafana update # show v<current> -> v<latest>, ask "Update now? [Y/n]", install
grafana update --yes # install without the prompt
grafana update --check # report current and latest versions
grafana update --check -o json # the same, as JSONgrafana update works on macOS, Linux, and Windows. It downloads the release
archive for your platform, verifies its SHA-256 against the release's
checksums.txt, and replaces the running binary. On Windows the old
grafana.exe is renamed to grafana.exe.old and deleted on a later start. If
the binary's directory is not writable, re-run with sudo or reinstall with the
install script into a writable directory; the old binary keeps working.
A grafana built from source into a Go bin directory ($GOBIN, $GOPATH/bin,
or ~/go/bin) is not replaced. Update it with git pull && make install in
your grafana-cli/cli-go checkout.
Update notice
When a newer release exists, grafana prints a notice on stderr after the
command's output, at most once a day per version:
A new version of grafana is available: v0.2.9 -> v0.2.10
Update with: grafana update
Release notes: https://github.com/piyush-gambhir/grafana-cli/releases/tag/v0.2.10The release check runs at most once a day and only when stderr is a terminal,
so scripts, CI, and coding agents never see it. To turn it off, set
GRAFANA_NO_UPDATE_NOTIFIER=1 or NO_UPDATE_NOTIFIER=1. It is also skipped
when CI is set and with --quiet (or GRAFANA_QUIET=1).
Verify
grafana version