sharkdp / bat

A cat(1) clone with wings.
Apache License 2.0
48.6k stars 1.23k forks source link

bat fails to run due to dependency on older libgit2 version on macOS #3029

Open applebait opened 1 month ago

applebait commented 1 month ago

Hello,

I am having an issue running bat on my macOS system. When I try to run bat, I get the following error message:

dyld[15323]: Library not loaded: /opt/homebrew/opt/libgit2@1.7/lib/libgit2.1.7.dylib
  Referenced from: <968B81E5-4BAB-323C-8FD5-1BFB54F3052D> /opt/homebrew/Cellar/bat/0.24.0_1/bin/bat
  Reason: tried: '/opt/homebrew/opt/libgit2@1.7/lib/libgit2.1.7.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libgit2@1.7/lib/libgit2.1.7.dylib' (no such file), '/opt/homebrew/opt/libgit2@1.7/lib/libgit2.1.7.dylib' (no such file), '/opt/homebrew/Cellar/libgit2/1.8.1/lib/libgit2.1.7.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/Cellar/libgit2/1.8.1/lib/libgit2.1.7.dylib' (no such file), '/opt/homebrew/Cellar/libgit2/1.8.1/lib/libgit2.1.7.dylib' (no such file)

It appears that bat is trying to load libgit2.1.7.dylib, but I have libgit2 version 1.8.1 installed on my system. I tried reinstalling both bat and libgit2 using Homebrew, but the issue persists. I am currently unable to uninstall libgit2 1.8.1 because other installed applications depend on it. I would appreciate any guidance on how to resolve this issue. Please let me know if you need any additional information about my system or the steps I've taken.

Thanks.

applebait commented 1 month ago

Ok, this is far from a bat issue. This is a libgit2 issue. I just installed libgit2@1.7 and it's all working again.

suchcodemuchwow commented 1 month ago

I'm having the same issue how did you download libgit2@1.7, did you install from source?

adamreese commented 1 month ago

I ran brew uninstall bat && brew install bat and the issue seemed to be resolved

marcoreni commented 1 month ago

I solved this with brew install libgit2@1.7.

LanikSJ commented 1 month ago

I ran brew uninstall bat && brew install bat and the issue seemed to be resolved

This was addressed upstream by Homebrew: https://github.com/Homebrew/homebrew-core/pull/166767

simon-aira commented 1 month ago

Thanks to this thread, I resolved this be using brew uninstall bat && brew install bat. Out of curiousity – why did not brew upgrade bat help? I tried that first and it didn't help..

squatto commented 1 month ago

I'd recommend using brew reinstall bat instead of brew uninstall bat && brew install bat. Using reinstall ensures that the reinstall uses the original installation options.

From the help:

Usage: brew reinstall [options] formula|cask [...]

Uninstall and then reinstall a formula or cask using the same options it was
originally installed with, plus any appended options specific to a formula.
mercxry commented 1 week ago

I was having this issue today and I solved it by reinstalling libgit2@1.7 with: brew reinstall libgit2@1.7