I need to know the most efficient way of installing JQ on Mac (el capitan). The code is downloaded to my mac but I would like to know how I can install and operate the via the c
You can install any application/packages with brew on mac. If you want to know the exact command just search your package on https://brewinstall.org and you will get the set of commands needed to install that package.
First open terminal and install brew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null
Now Install jq
brew install jq
For most it is a breeze, however like you I had a difficult time installing jq
The best resources I found are: https://stedolan.github.io/jq/download/ and http://macappstore.org/jq/
However neither worked for me. I run python 2 & 3, and use brew in addition to pip, as well as Jupyter. I was only successful after brew uninstall jq then updating brew and rebooting my system
What worked for me was removing all previous installs then pip install jq
On a Mac, the "most efficient" way to install jq would probably be using homebrew, e.g.
brew install jq
If you want the development version, you could try:
brew install --HEAD jq
but this has various pre-requisites.
Detailed instructions are on the "Installation" page of the jq wiki: https://github.com/stedolan/jq/wiki/Installation
The same page also includes details regarding installation from source, and has notes on installing with MacPorts.
For CentOS, RHEL, Amazon Linux: sudo yum install jq
The simplest way to install jq
and test that it works is through brew and then using the simplest filter that merely formats the JSON
brew
is the easiest way to manage packages on a mac:
brew install jq
Need brew
? Run the following command:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Failing that: instructions to install and use are on https://brew.sh/
The .
filter takes its input and produces it unchanged as output. This is the identity operator. (quote the docs)
echo '{ "name":"John", "age":31, "city":"New York" }' | jq .
The result should appear like so in your terminal:
{
"name": "John",
"age": 31,
"city": "New York"
}