Started using so much of jq on Linux, I wanted to use it on my Mac as well. Most of the internet posts point to the use of homebrew to install jq. I was looking for an easier option and got to the following.
Download jq binary for Mac from https://jqlang.github.io/jq/download/
$ sudo cp ~/Downloads/jq-macos-arm64 /usr/local/bin/jq
$ sudo chmod +x /usr/local/bin/jq
If you try to run jq you will get the following warning.
“jq” can’t be opened because Apple cannot check it for malicious software.
If so, do the following which should allow you to run jq without any issues.
$ sudo xattr -dr com.apple.quarantine /usr/local/bin/jq
You can check if jq works with a simple command like the following.
$ echo '{"foo": 0}' | jq .
{
"foo": 0
}