zsh exec format error for executing jq

jq command could not execute correctly on mac os terminal zsh, but same command work perfectly on ubuntu,

curl http://api.open-notify.org/iss-now.json | jq '.'

my zsh is updated.

my os is macOS Monterey

Thank you in advance.

MacBook Pro 13″, macOS 10.15

Posted on Mar 6, 2022 12:45 AM

Reply
2 replies

Mar 6, 2022 3:39 AM in response to amir_abbas

The last version of jq was introduced in 2018, I believe, and though written in C, macOS does not provide the same compilation environment that is present with Ubuntu, nor the same libraries. It must be installed with a package manager (snap) on Ubuntu too.


Even the macOS curl command is several revisions behind that available on Ubuntu. Lots of variables that introduce "could not execute correctly on macOS." Additionally, the default shell in Ubuntu is Bash 5, not Zsh 5.8, and if that jq source has any Bash dependencies while running, that may be the smoking gun. By your stating that your Zsh is updated, would that imply that you used a package manager to install Zsh v5.8.1, which Apple does not provide (yet) with Monterey?


Mar 6, 2022 9:26 PM in response to VikingOSX

currently zsh is chose the built-in command line in terminal application by Apple. and for installing or updating the zsh on mac we just run homebrew. this problem exist from several previous version of maOS, even when you intentionally run jq by bash in terminal, the result is "bash: /usr/local/bin/jq: cannot execute binary file" but the jq binary exists at the stated path.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

zsh exec format error for executing jq

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.