On Mac OS 13.2, in zsh, ls returns the following error message:
dyld[15164]: Library not loaded: /usr/local/opt/libgit2/lib/libgit2.1.6.dylib
Referenced from: <14346135-E664-31AF-A80B-05A5335ED5D7> /usr/local/Cellar/exa/0.10.1_1/bin/exa
Reason: tried: '/usr/local/opt/libgit2/lib/libgit2.1.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/libgit2/lib/libgit2.1.6.dylib' (no such file), '/usr/local/opt/libgit2/lib/libgit2.1.6.dylib' (no such file), '/usr/local/lib/libgit2.1.6.dylib' (no such file), '/usr/lib/libgit2.1.6.dylib' (no such file, not in dyld cache), '/usr/local/Cellar/libgit2/1.7.2/lib/libgit2.1.6.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/Cellar/libgit2/1.7.2/lib/libgit2.1.6.dylib' (no such file), '/usr/local/Cellar/libgit2/1.7.2/lib/libgit2.1.6.dylib' (no such file), '/usr/local/lib/libgit2.1.6.dylib' (no such file), '/usr/lib/libgit2.1.6.dylib' (no such file, not in dyld cache)
zsh: abort exa -1 --classify --group-directories-first
This seems to have started happening after a Homebrew upgrade.
I had hoped this answer would be what I needed, but I could modify it to work for my case.
How can I fix this problem?
Update
Somehow the problem seems to be that the version of libgit2 in that directory is a more recent one but everything is still calling the old version: I went cd /usr/local/opt/libgit2/lib/ and found (using the Finder, not ls of course) that this directory contains libgit2.1.7.2.dylib but no libgit2.1.6.dylib. Maybe I should just make a symlink for that old version? Or would that cause other problems?
I tried brew unlink libgit2 then brew link libgit2; I tried brew uninstall libgit2 then `brew install libgit2; and I tried installing the latest Command Line Tools, restarting the computer, etc. But I still have this problem.
Here is one answer that I just tried, which worked, though I am not sure it is the best way to do this:
I did what I described in the "Update" to my question, namely
cd /usr/local/opt/libgit2/lib/followed byln -s libgit2.1.7.2.dylib libgit2.1.6.dylib. Nowlsis working again.But is that the right way to fix this issue? It feels a bit like a hack that might cause other problems.