Install k6

One binary, no Node, no deps.

3 mineasy

k6 is a single Go binary. No Node. No Python. No dependencies. Three install methods covered here — pick the one that matches your OS.

macOS — Homebrew

brew install k6

Linux — apt / yum / pacman

# Debian / Ubuntu
sudo gpg -k
sudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69
echo "deb [signed-by=/usr/share/keyrings/k6-archive-keyring.gpg] https://dl.k6.io/deb stable main" | sudo tee /etc/apt/sources.list.d/k6.list
sudo apt-get update
sudo apt-get install k6
# Arch
sudo pacman -S k6

Windows — Chocolatey or Scoop

# Chocolatey
choco install k6
# Or Scoop
scoop install k6

Docker — if you don't want to install

docker run --rm -i grafana/k6 run - <script.js

The -i pipes your local script into the container. Useful in CI; clunky in dev. Native install is usually nicer.

Verify

k6 version
# k6 v0.50.0 (2024-04-18T...)

Any 0.50+ works. Most APIs in this course assume features from 0.49 or later.

The k6 binary on its own

k6 has no UI. It's pure CLI. You write a JavaScript file (k6 has its own JS runtime, NOT Node), then run k6 run script.js. Output goes to your terminal. That's the entire mental model.

k6 cloud is optional. Grafana also runs a SaaS for k6 — pretty dashboards, team scaling. You don't need it to learn or use k6. Skip it; come back if you need centralised results.

Where to keep your scripts

my-grit-app/
└── tests/
└── k6/
├── smoke.js
├── load.js
├── stress.js
├── spike.js
├── soak.js
└── lib/
├── auth.js ← reusable: log in, get a token
└── thresholds.js ← shared SLO thresholds

Tests live with code. Same repo, version-controlled. Anyone can run them.

Try it

Confirm installation:

  1. Install k6 via the method for your OS.
  2. Run k6 version and capture the output.
  3. Make a folder tests/k6/ in your Grit project — we'll put real scripts there next lesson.
  4. Paste the version output into notes.md.

What's next

Next — Your first k6 script. A real test against your running Grit API.

Spot a typo? Have an idea?

Help us improve this lesson. One click opens a GitHub issue with the lesson URL pre-filled — suggest clearer wording, report a bug, or request more depth. The course keeps improving thanks to learners like you.

Suggest an improvement on GitHub