From d23abed66d334f81f65c7f7124d02fa7657b4671 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Wed, 4 Mar 2026 17:24:50 -0500 Subject: [PATCH] perf(magit): use /usr/bin/git on macos Inexplicably, the built-in git on MacOS is many orders of magnitude faster than the external builds provided by Homebrew/Macports, so use that there. Emacs on MacOS needs all the (performance) help it can get and, fortunately, the bundled git is 2.23 or newer on (at least) MacOS 10.15 (Catalina) and newer, so this should be a relatively safe bet without the need for version checks. --- modules/tools/magit/config.el | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/modules/tools/magit/config.el b/modules/tools/magit/config.el index e051d557b..3d61ffc00 100644 --- a/modules/tools/magit/config.el +++ b/modules/tools/magit/config.el @@ -71,7 +71,14 @@ FUNCTION ;; enough that a non-absolute path can notably slow it down, ;; especially on MacOS and Windows, so I resolve it once, the first ;; time it's needed. - magit-git-executable (or (executable-find magit-git-executable) "git")) + magit-git-executable (or + ;; PERF: Inexplicably, the built-in git on MacOS + ;; is much faster than the one provided by + ;; homebrew, so use that instead there. + (and (featurep :system 'macos) + (file-exists-p! "/usr/bin/git")) + (executable-find magit-git-executable) + "git")) ;; Turn ref links into clickable buttons. (add-hook 'magit-process-mode-hook #'goto-address-mode)