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
}
Disclaimer: The above is for information purposes only. As always use any sudo commands and security overriding commands with caution.
It’s great to see how jq is becoming more accessible across different operating systems. Using homebrew seems to be the go-to method for installation on Mac. The warning about malicious software can be a bit alarming, but following the steps provided should resolve it. Checking if jq works with a simple command is a smart way to ensure everything is set up correctly. Is there any alternative method to install jq that doesn’t involve homebrew?
Not sure if there is another way but one way to ensure we are indeed installing the genuine jq software is to check the checksum of jq for the platform you downloaded against the published checksum in Github.
https://github.com/jqlang/jq/blob/913b26469f47351a9f75a1bc4145f45421115e37/sig/v1.7.1/sha256sum.txt#L22C1-L22C81