Jq: How to compile jq on MacOS?

Created on 18 Feb 2020  路  5Comments  路  Source: stedolan/jq

I'm sorry... I read the request to use SO, but they're a vicious bunch with their "downvotes"...

Describe the bug

A clear and concise description of what the bug is.

The following attempts to get a working jq on my Mac have failed. I have labeled them as Issue 1, and Issue 2 below:

Issue 1:

This download link deposits a file in ~/Downloads, but no instructions on what to do with it?! Is this a dmg file without the file extension? Is it compressed without a file extension? I have no clue without the file extension, and nothing I could find in your documentation offers an answer.

Issue 2:

Not having much experience in downloading and compiling things, but vehemently opposed to using brew or homebrew, I attempted to follow the instructions to "roll my own":

Starting from this page at the line beginning with: From source on Linux, OS X,..., I download the source tarball for jq v 1.6

I read the README file & get this as the most clear instruction in the word soup (i.e. your README could use some improvements!)

./configure --with-oniguruma=builtin --disable-maintainer-mode

But following that advice yields this:

=== configuring in modules/oniguruma (/Users/seamus/Downloads/jq-1.6/modules/oniguruma)
configure: WARNING: no configuration information is in modules/oniguruma

To Reproduce

Provide a minimal test case to reproduce the behavior.
If the input is large, either attach it as a file, or create a gist and link to it here.

  • Download the source tarball for jq v 1.6 to ~/Downloads

  • Unzip contents... -> folder: ~/Downloads/jq-1.6

  • From the terminal: cd ~/Downloads/jq-1.6

  • From the terminal: ./configure --with-oniguruma=builtin --disable-maintainer-mode

  • Yes, I can read the result... it says that the folder ~/Downloads/jq-1.6/modules/oniguruma has "no information". Agree! Question is what to do about that? The README says it's needed for regexp support, and the README also says, "To get regexp support you'll also need to install Oniguruma", but that's ambiguous IMHO.

  • I chose not to use git because there are additional dependencies: "... you'll need flex,
    bison (3.0 or newer), libtool, make, and autoconf installed".

Expected behavior:

Expected behavior
A clear and concise description of what you expected to happen.

:) I expected the instructions would lead to a working binary jq ! I could then copy this binary to my preferred loaction, chmod & begin using it... Instead of faffing around for the best part of half a day.

Environment

Environment (please complete the following information):

  • OS and Version: [e.g. macOS, Windows, Linux (please specify distro)]
  • jq version [e.g. 1.5]
  • MacOS Mojave, ver 10.14.6

  • jq ver 1.6

Additional context

Additional context
Add any other context about the problem here.

I really would like to try jq. I need it to run under MacOS. I don't mind compiling, but I need complete instructions on dealing with the dependencies. I do not now, nor will I ever, install brew on my machine... I think too much of my machine and my time to try that again.

Thanks for your help & please let me know if you need anything further from me.

All 5 comments

I have no clue without the file extension, and nothing I could find in your documentation offers an answer.

That's a statically-linked binary. If you set the execute bit on it chmod +x jq-osx-amd64, you can just execute it. (Relatedly, there's a file command which attempts to detect the type of a file- file jq-osx-amd64 returns Mach-O 64-bit executable x86_64 for me)

=== configuring in modules/oniguruma (/Users/seamus/Downloads/jq-1.6/modules/oniguruma) configure: WARNING: no configuration information is in modules/oniguruma

Hm, looks like that source distribution is missing a configure script for oniguruma, which is pretty weird (I might have expected to get a report about that sooner than now). You could fix that by running autoreconf -fi in the jq-1.6 folder, but that requires you to have autotools installed which you might not have.

That's a statically-linked binary. If you set the execute bit on it chmod +x jq-osx-amd64, you can just execute it.

That's perfect... in this case I prefer statically linked!

The file cmd you suggested is a good one. I used "Get Info" from Finder & it said it was "TextEdit.app Document" :) But even if I'd run file, it wouldn't have convinced me this was what I needed because:

  1. I was expecting to get a binary named... jq
  2. Nothing I read here suggested this was actually jq.

You could fix that by running autoreconf -fi in the jq-1.6 folder, but that requires you to have autotools installed which you might not have.

Yeah... but I don't. And hard to get excited about Apple's XCode as it doesn't generate a lot of rave reviews :)

Many thanks for the info. I'll rename jq-osx-amd64 to jq, chmod & relocate it to its permanent home.

Looks like a closable issue.

You can close it if you like, but I don't think the original issue was resolved; see @wtlangford 's response re oniguruma. However, @wtlangford did sort the "binary mystery" for me :)

Unfortunately, I can't fix the existing source tarball without breaking packages in some distributions- they do some SHA sums or similar on the downloaded tarballs and I've accidentally broken them before.

I'll remember this as an issue when generating tarballs in the future, though. I'll update the documentation as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ghost picture ghost  路  4Comments

tbelaire picture tbelaire  路  4Comments

ve3ied picture ve3ied  路  4Comments

kelchy picture kelchy  路  4Comments

sonots picture sonots  路  3Comments