yq: Install on a CI Runner (snap vs binary)
The reliable way to get mikefarah/yq on a runner is its static GitHub release binary; snap, apt, and pip can give you the wrong tool or a sandboxed one.
Half of yq problems in CI are install problems: the binary is missing, or the package manager installed the Python yq, or snap sandboxed it away from your files. Pin the release binary.
What it does
mikefarah/yq ships as a single static binary per platform on its GitHub releases page. Downloading it directly gives a known version with the Go syntax. pip install yq installs the unrelated Python tool; some distro packages and snap may install either, and snap confinement can block file access.
Common usage
# install the Go yq release binary (Linux amd64)
sudo wget -qO /usr/local/bin/yq \
https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
sudo chmod +x /usr/local/bin/yq
yq --version # expect: ... mikefarah ... v4.xInstall methods
| Method | What you get |
|---|---|
| GitHub release binary | mikefarah/yq, pinned, recommended |
| snap install yq | mikefarah/yq but confined (file access issues) |
| pip install yq | kislyuk/yq (Python, wrong syntax for Go scripts) |
| apt/brew install yq | Varies by distro; verify with --version |
| Docker mikefarah/yq | Go yq in a container, mount your files in |
In CI
On GitHub Actions, ubuntu-latest already ships mikefarah/yq, so no install step is needed there. On minimal or self-managed runners, download the release binary to a PATH directory rather than relying on the package manager, and pin a version tag for reproducibility.
Common errors in CI
"yq: command not found" means yq is not installed or not on PATH; add the install step or check the PATH. snap-installed yq hitting "permission denied" or "cannot open" on files outside $HOME is snap confinement; use the release binary instead. If yq is present but your = and -i edits do nothing, pip installed the Python yq; reinstall the Go binary and confirm with yq --version.