Skip to main content

Overview

k6 is available for all major platforms. Choose your preferred installation method below.

Linux

Install via package managers or download binaries

macOS

Install with Homebrew or download directly

Windows

Install with package managers or executables

Docker

Run k6 in containers without installation

Installation methods

Using Homebrew

The easiest way to install k6 on macOS is using Homebrew:
brew install k6

Verify installation

Check that k6 is installed correctly:
k6 version
Homebrew automatically handles updates. Run brew upgrade k6 to get the latest version.

Build from source

For developers who want to build k6 from source:
1

Install Go

Make sure you have Go installed (version 1.21 or later).
go version
2

Clone the repository

Clone the k6 repository from GitHub:
git clone https://github.com/grafana/k6.git
cd k6
3

Build k6

Build the k6 binary:
go build -o k6 .
4

Verify the build

Check that k6 was built successfully:
./k6 version
Building from source gives you access to the latest features and allows you to customize k6 for your specific needs.

Install k6 extensions

k6 has a rich ecosystem of extensions that add support for new protocols and features:

Using xk6

xk6 is the official tool for building k6 with extensions:
# Install xk6
go install go.k6.io/xk6/cmd/xk6@latest

# Build k6 with extensions
xk6 build --with github.com/grafana/xk6-sql
Explore available extensions at the k6 extensions page.

Verify your installation

After installation, verify k6 is working correctly:
k6 version

Troubleshooting

If you get a “command not found” error:
  • Make sure k6 is in your PATH
  • Try closing and reopening your terminal
  • On Windows, restart Command Prompt or PowerShell after installation
If you encounter permission errors:
sudo chmod +x /usr/local/bin/k6
Or use sudo when running installation commands.
If your test scripts aren’t being found in Docker:
  • Make sure you’re using absolute paths or $(pwd)
  • On Windows, use ${PWD} in PowerShell or %cd% in Command Prompt
  • Check that the script file exists in the mounted directory

Next steps

Quick start guide

Now that k6 is installed, let’s run your first load test!
Always verify your k6 installation before running production tests. Use k6 version to ensure you’re running the expected version.

Build docs developers (and LLMs) love