Install k6
One binary, no Node, no deps.
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 / Ubuntusudo gpg -ksudo gpg --no-default-keyring --keyring /usr/share/keyrings/k6-archive-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C5AD17C747E3415A3642D57D77C6C491D6AC1D69echo "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.listsudo apt-get updatesudo apt-get install k6# Archsudo pacman -S k6
Windows — Chocolatey or Scoop
# Chocolateychoco install k6# Or Scoopscoop 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.
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:
- Install k6 via the method for your OS.
- Run
k6 versionand capture the output. - Make a folder
tests/k6/in your Grit project — we'll put real scripts there next lesson. - 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