the_silver_searcher
the_silver_searcher copied to clipboard
Process gets killed on M1 Apple chips
Thanks for such a great tool! It's really integral to my productivity.
Unfortunately, I've installed ag
through Homebrew on a new M1 MacBook Pro running OS 11.1. Running under both ZSH and Bash, when I try and run ag
, the command is immediately killed without running. If there are debugging steps I can take to get more information for what's causing it to be killed, I'm more than happy to look into it.
Thanks!
$ brew install the_silver_searcher --HEAD
$ file =ag
/opt/homebrew/bin/ag: Mach-O 64-bit executable arm64
Using ag
works fine for me with this.
Thanks for the comment. While the command you've suggested does work for me when I run it, when trying to actually run ag
, this is what I get:
$ ag "Hello"
[1] 68819 killed ag "Hello"
What does echo $?
print after the command you have posted? And what does
$ file `which ag`
print for you?
Thanks for the help! Here's the three commands, with their output, back-to-back:
$ ag "Hello"
[1] 1151 killed ag "Hello"
$ echo $?
137
$ file `which ag`
/opt/homebrew/bin/ag: Mach-O 64-bit executable arm64
This was run in zsh
. Running the same in bash
, I get the same output, except for ag
where I get Killed: 9
. macOS Big Sur 11.2.3 on the M1 MacBook Pro, 16GB memory if this helps.
137 and -9 are the same return code, but zsh
interprets it as uint8
, while bash
interprets it as int8
(I never understood why they do it differently), and it means that the process received SIGKILL
. Why the process receives such a signal can have multiple reasons, so meh 😕
However, after googling a bit, my wild guess is that the libpcre
you have installed is built for the wrong architecture.
Do you mind to check the output of the following?
otool -L `which ag` | awk '{ print $1 }' | grep pcre | xargs file
/opt/homebrew/opt/pcre/lib/libpcre.1.dylib: Mach-O 64-bit dynamically linked shared library arm64
If your libpcre.dylib
isn't for arm64, brew reinstall pcre2
should fix it as suggested in the linked issue.
Thank you so much for digging in and helping out!
Ok, unfortunately, that didn't resolve the issue. Running the command you shared, the arm64
version was installed. I tried reinstalling it anyway, and reinstalling ag
after that, but I'm still getting the same errors.
What's the output of file
for other libs listed by otool
(with /opt/homebrew
prefix only)?
$ otool -L `which ag`
/opt/homebrew/bin/ag:
/opt/homebrew/opt/pcre/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.12.0)
/opt/homebrew/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.5.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
$ file /opt/homebrew/opt/xz/lib/liblzma.5.dylib
/opt/homebrew/opt/xz/lib/liblzma.5.dylib: Mach-O 64-bit dynamically linked shared library arm64
Again, really appreciate you looking into this! It looks like my output is the same as yours:
$ otool -L `which ag`
/opt/homebrew/bin/ag:
/opt/homebrew/opt/pcre/lib/libpcre.1.dylib (compatibility version 4.0.0, current version 4.12.0)
/opt/homebrew/opt/xz/lib/liblzma.5.dylib (compatibility version 8.0.0, current version 8.5.0)
/usr/lib/libz.1.dylib (compatibility version 1.0.0, current version 1.2.11)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
$ file /opt/homebrew/opt/xz/lib/liblzma.5.dylib
/opt/homebrew/opt/xz/lib/liblzma.5.dylib: Mach-O 64-bit dynamically linked shared library arm64
Running 'brew reinstall pcre' on my M1 Mac Mini worked. ag is now working thanks.