What is jq?

jq selects and transforms JSON data from the command line.

Homebrew installs jq as a formula: a package definition for command-line software and its dependencies. If Homebrew is not installed yet, follow the official installation guide before continuing.

Install and check the formula

Refresh Homebrew’s package definitions, then install jq. Use brew info to inspect the current package and its dependencies; the actual installed version can change over time.

brew update
brew install jq
brew info jq

Try it

The filter selects the name field from a small JSON document. jq prints a JSON string by default.

printf '%s\n' '{"name":"Casklane"}' | jq '.name'

Before you rely on it

For automation, handle invalid JSON and missing fields; do not assume an API response always has the expected shape.

yq is useful when the input is YAML rather than JSON; confirm its syntax and implementation before adapting examples.

Update or remove it

Run brew outdated to see if a newer version is available, and brew upgrade jq to upgrade this formula. Before removing it, preview the changes; other packages may depend on it.

brew outdated
brew upgrade jq
brew uninstall --dry-run jq

Sources and further reading