Home > database >  How to install `yq` with Mach-O 64-bit executable? I got error `bad CPU executable`
How to install `yq` with Mach-O 64-bit executable? I got error `bad CPU executable`

Time:02-08

I'm not very familiar with Mac system, so I used brew install jq and brew install yq, then I got:

$ file /usr/local/bin/xxx/lib/jq
/usr/local/bin/xxx/lib/jq: Mach-O 64-bit executable x86_64

$ file /usr/local/bin/xxx/lib/yq
/usr/local/bin/xxx/lib/yq: Mach-O executable i386

Then when I run something and it gave me an error:

/usr/local/bin/xxx/lib/yq: Bad CPU type in exectable

I'm thinking this can be fixed if I can install yq with Mach-O 64-bit executable x86_64, does anyone know how to do it? Thanks.

CodePudding user response:

It's unexpected of brew to install an i386 binary that can't work on macOS >= 10.15

Instead of recompiling yq, you can just download the stand-alone binary, put the yq executable somewhere in your PATH and you're done with the installation:

  • yq_darwin_amd64 is for Macs with Intel CPU
  • yq_darwin_arm64 is for Macs with Apple CPU
  •  Tags:  
  • Related