I've recently-ish updated from an Intel-based Mac to an M1-based Mac and I was also switching off a beta 12.x OS to regular 12.x macOS.
I have no idea what is going on but it seems like my shell commands (from /usr/local/bin/) are all crashing (not the terminal, it just generates a crash report)?
As in when I run a, for example, curl command I get zsh: killed [my command] and I get a:
"Problem Report for curl
curl quit unexpectedly
This report will be sent automatically to Apple."
And a crash report that looks like this:
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------
Hardware Model: MacBookPro18,2
Process: curl [9680]
Path: /usr/local/bin/curl
Identifier: curl
Version: ???
Code Type: X86-64 (Native)
Role: Unspecified
Parent Process: zsh [9670]
Coalition: com.googlecode.iterm2 [2032]
Responsible Process: iTerm2 [9667]
Date/Time: 2022-07-26 23:28:33.8207 -0400
Launch Time: 2022-07-26 23:28:33.7931 -0400
OS Version: macOS 12.5 (21G72)
Release Type: User
Report Version: 104
Exception Type: EXC_CRASH (SIGKILL (Code Signature Invalid))
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Termination Reason: CODESIGNING 1
Highlighted by Thread: 0
Backtrace not available
No thread state (register information) available
Binary Images:
Binary images description not available
Error Formulating Crash Report:
_dyld_process_info_create failed with 6
dyld_process_snapshot_get_shared_cache failed
Failed to create CSSymbolicatorRef - corpse still valid ¯\_(ツ)_/¯
EOF
What is going on? All the crash reports I get claim its a code signing issue??
I tried reinstalling macOS already as well.
It seems to be finding the right command (that path in my crash report is in my $PATH) but it just fails most of the time (i can sometimes get which to work, but it fails other times when other commands or processes call it).
EDIT:
i had a suspicion it was a homebrew issue.. the only problem is I can't run brew reinstall curl because I get new crash reports that dirname and readlink crashed and my terminal complains that: /bin/bash: /usr/local/Library/Homebrew/brew.sh: No such file or directory
(which brew gives me /usr/local/bin/brew)
And then if I try to uninstall homebrew to reinstall, I can't run any curl commands.. So I also tried manually copying and pasting the uninstall script and saving to to my desktop and running it.
I gave the script permissions by running chmod +x /Users/[me]/Desktop/uninstall.sh and then running it with both bash /Users/[me]/Desktop/uninstall.sh and sh /Users/[me]/Desktop/uninstall.sh (and even the linked comment of /bin/bash /Users/[me]/Desktop/uninstall.sh but the terminal complains Unsupported system type '' and i get a crash report that "uname quit unexpectedly"
which seems to happen because the script attempts to run uname internally:
...
un="$(uname)"
case "${un}" in
...
the error message comes from the case statement not matching anything