Search code examples
xcodegitmacoshomebrewsigabrt

How do I make git work again? And why is Xcode not updating?


Recently tried to use git on a Mac to push changes to a repository, and it's no longer working. It eventually led me to find other issues as well.

This is the result of git version:

dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/git
  Reason: image not found
zsh: abort      git --version

Then I tried brew install git :

dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/git
  Reason: image not found
Running `brew update --preinstall`...
==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).

dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/git
  Reason: image not found
Error: Command failed with SIGABRT (signal 6): git
Warning: git 2.34.1 is already installed and up-to-date.
To reinstall 2.34.1, run:
  brew reinstall git

And when running brew reinstall git:

==> Downloading https://ghcr.io/v2/homebrew/core/git/manifests/2.34.1
Already downloaded: /Users/hectorbardales/Library/Caches/Homebrew/downloads/2204d96aaa794aa4c0eb0d196b6eb24296243d67f3e13221da63ef109f6ee774--git-2.34.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/git/blobs/sha256:e3671284f82922871a0452d7d9f829a01757b96fc8
Already downloaded: /Users/hectorbardales/Library/Caches/Homebrew/downloads/e3ecb2e86aa74f77bb36ea2154eeed0dc030e8d847ba9e6ab24a6040dcc631ea--git--2.34.1.big_sur.bottle.tar.gz
==> Reinstalling git 
==> Pouring git--2.34.1.big_sur.bottle.tar.gz
==> Caveats
The Tcl/Tk GUIs (e.g. gitk, git-gui) are now in the `git-gui` formula.
Subversion interoperability (git-svn) is now in the `git-svn` formula.

zsh completions and functions have been installed to:
  /usr/local/share/zsh/site-functions

Emacs Lisp files have been installed to:
  /usr/local/share/emacs/site-lisp/git
==> Summary
🍺  /usr/local/Cellar/git/2.34.1: 1,513 files, 42.7MB
==> `brew cleanup` has not been run in the last 30 days, running now...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
Removing: /Users/hectorbardales/Library/Caches/Homebrew/autoconf--2.71... (948.6KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/ca-certificates--2021-10-26... (117.6KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/gettext--0.21... (8.5MB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/git--2.34.1... (15.3MB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/jq--1.6... (423.4KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/m4--1.4.19... (257.8KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/mpdecimal--2.5.1... (548.3KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/oniguruma--6.9.7.1... (441.8KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/pcre2--10.39... (2.0MB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/pkg-config--0.29.2_3... (239.6KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/readline--8.1.1... (535.3KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/xz--5.2.5... (417.6KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/descriptions.json... (327.0KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/xz_bottle_manifest--5.2.5... (7.4KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/m4_bottle_manifest--1.4.19... (7.0KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/ca-certificates_bottle_manifest--2021-10-26... (1.8KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/sqlite_bottle_manifest--3.36.0... (7.8KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/external_commands_list.txt... (75B)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/gdbm_bottle_manifest--1.21_1... (7.0KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/oniguruma_bottle_manifest--6.9.7.1... (7.3KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/portable-ruby-2.6.8.yosemite.bottle.tar.gz... (8.8MB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/pyenv_bottle_manifest--2.2.0... (22.2KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/readline_bottle_manifest--8.1.1... (7.5KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/jq_bottle_manifest--1.6-1... (8.5KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/all_commands_list.txt... (981B)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/pcre2_bottle_manifest--10.39... (7.4KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/autoconf_bottle_manifest--2.71... (9.4KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/[email protected]_bottle_manifest--3.9.7_1... (21.6KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/[email protected]_bottle_manifest--1.1.1l_1... (8.7KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/mpdecimal_bottle_manifest--2.5.1... (6.9KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/gettext_bottle_manifest--0.21... (10.5KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/git_bottle_manifest--2.34.1... (11.2KB)
Removing: /Users/hectorbardales/Library/Caches/Homebrew/pkg-config_bottle_manifest--0.29.2_3... (7.4KB)
Removing: /Users/hectorbardales/Library/Logs/Homebrew/gettext... (64B)
Removing: /Users/hectorbardales/Library/Logs/Homebrew/oniguruma... (64B)
Removing: /Users/hectorbardales/Library/Logs/Homebrew/pcre2... (64B)
Removing: /Users/hectorbardales/Library/Logs/Homebrew/jq... (64B)
Removing: /Users/hectorbardales/Library/Logs/Homebrew/git... (64B)
Pruned 2 symbolic links from /usr/local

I checked my homebrew version with brew -v:

Homebrew >=2.5.0 (shallow or no git repository)
dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/git
  Reason: image not found
Homebrew/homebrew-core (no Git repository)
dyld: Library not loaded: /usr/local/opt/gettext/lib/libintl.8.dylib
  Referenced from: /usr/local/bin/git
  Reason: image not found
Homebrew/homebrew-cask (no Git repository)

I proceeded to try brew doctor:

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  libimobiledevice
  gmp
  libplist
  nettle

Warning: Homebrew's "sbin" was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting your PATH for example like so:
  echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc

Warning: Your Xcode (13.0) is outdated.
Please update to Xcode 13.1 (or delete it).
Xcode can be updated from the App Store.


Warning: Some installed formulae are missing dependencies.
You should `brew install` the missing dependencies:
  brew install libtasn1 libusb libusbmuxd

Based on the warning I tried to update the xcode app, it initially didn't let me so I updated my Macos to Monterey. Once the console app told me Xcode update reached 1000/1000 I noticed the button on the app store once again said "update". I also got this message on the console app after xcode was supposedly updated:

ASDAppQuery.resultsDidChange 497799835: <BundleID=com.apple.dt.Xcode, Installed=true, LaunchProhibited=false, IsBeta=false>

Here is the result from git status:

dyld[1522]: Library not loaded: '/usr/local/opt/gettext/lib/libintl.8.dylib'
  Referenced from: '/usr/local/Cellar/git/2.34.1/bin/git'
  Reason: tried: '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/usr/local/lib/libintl.8.dylib' (no such file), '/usr/lib/libintl.8.dylib' (no such file), '/usr/local/Cellar/gettext/0.21/lib/libintl.8.dylib' (no such file), '/usr/local/lib/libintl.8.dylib' (no such file), '/usr/lib/libintl.8.dylib' (no such file)
zsh: abort      git status

And from git rebase --abort:

  Referenced from: '/usr/local/Cellar/git/2.34.1/bin/git'
  Reason: tried: '/usr/local/opt/gettext/lib/libintl.8.dylib' (no such file), '/usr/local/lib/libintl.8.dylib' (no such file), '/usr/lib/libintl.8.dylib' (no such file), '/usr/local/Cellar/gettext/0.21/lib/libintl.8.dylib' (no such file), '/usr/local/lib/libintl.8.dylib' (no such file), '/usr/lib/libintl.8.dylib' (no such file)
zsh: abort      git rebase --abort

I don't know how to proceed from here. Also, I had previously tried Oh My Zsh. I checked with uninstall_oh_my_zsh:

zsh: command not found: uninstall_oh_my_zsh

Solution

  • I had two versions of git so I used homebrew to uninstall one. Xcode took several attempts until it was updated. You can check the progress by going to the Console app (not the terminal). Type app store in the search bar and press enter then start.

    I still have to figure out how to fix some warnings from brew doctor, but I'm able to push changes to my GitHub repository.

    Thanks @matt for the help.