Fix Slow Large Git Repositories on macOS: Performance Guide

GeneralFix Slow Large Git Repositories on macOS: Performance Guide

What Causes This Issue

Developers working with large Git repositories on macOS frequently encounter sluggish git status, git checkout, and git fetch operations. The problem intensifies when repositories exceed several gigabytes or contain hundreds of thousands of files — common in monorepos, game projects, and long-running iOS codebases. Users in the Apple Support Community report that performance degrades sharply after macOS upgrades, when Spotlight indexing conflicts with Git’s filesystem scanning, or when Xcode’s built-in source control attempts to scan the entire work tree.

Root causes include: the default fsmonitor daemon not running, untuned packfile configuration, missing commit-graph generation, and sparse checkout or partial clone features left disabled. Antivirus tools and Time Machine can also lock files during Git operations. On Apple Silicon, the issue sometimes stems from Rosetta-translated Git binaries instead of native arm64 builds.

Step-by-Step Fixes

  1. Enable and verify fsmonitor — Run git config --global core.fsmonitor true then git fsmonitor--daemon status. The daemon should report “running.” If it fails, ensure git is the native arm64 binary (arch -arm64 git version).
  2. Generate commit-graph and reachability bitmap — Execute git commit-graph write --reachable --split followed by git repack -ad --write-bitmap-index. This accelerates history traversal and git log by orders of magnitude.
  3. Configure sparse checkout for monorepos — In the repo root, run git sparse-checkout init --cone then git sparse-checkout set <directory1> <directory2> to limit the working tree to active folders. Pair with git clone --filter=blob:none --sparse for new clones.
  4. Tune packfile limits — Add to ~/.gitconfig:
    [pack]
    packSizeLimit = 2g
    threads = 0
    [repack]
    writeBitmaps = true
    This prevents excessive small packfiles and enables parallel delta compression.
  5. Exclude .git from Spotlight and Time Machine — Open System Settings → Siri & Spotlight → Spotlight Privacy, add the repository root. In Time Machine Options, exclude the same path. This stops metadata indexers from fighting Git for file handles.
  6. Upgrade to Git 2.45+ via Homebrew — Run brew install git and ensure /opt/homebrew/bin/git precedes /usr/bin/git in $PATH. Newer releases include fsmonitor–daemon improvements and bundle-uri support for faster fetches.
  7. Disable Xcode source control for massive repos — In Xcode Settings → Source Control, uncheck “Enable Source Control” for the project. Use command-line Git or a dedicated client (Tower, Fork, GitKraken) instead. Xcode’s scanner chokes on repos over 50k files.
  8. Run maintenance via cron — Add a daily job: 0 3 * * * cd /path/to/repo && git maintenance run --auto. This auto-schedules gc, commit-graph, and prefetch without manual intervention.

Additional Solutions

Partial clone with blobless filter reduces initial clone time and disk usage. Use git clone --filter=blob:none --sparse <url> then populate directories on demand. For CI runners, combine with --depth=1 and --branch to fetch only recent history.

Configure core.untrackedCache to true for repos with many ignored files (build artifacts, node_modules, DerivedData). This caches git status results between runs. Test first — some network filesystems misbehave with this setting.

Use git maintenance register to install launchd timers that run git maintenance run hourly. This keeps the repository optimized without cron. Verify with git maintenance start and check ~/Library/LaunchAgents/ for the plist.

Migrate LFS assets to a dedicated server if .git/lfs exceeds 10 GB. Large binary assets slow down git fetch and git push even with core.fsmonitor. Configure lfs.url to point to an S3-backed endpoint (e.g., https://lfs.example.com) and run git lfs migrate import --everything.

Check for filesystem case-sensitivity conflicts. APFS case-insensitive volumes cause Git to treat README.md and readme.md as the same file, triggering repeated index rewrites. Create a case-sensitive APFS volume via Disk Utility, clone there, and symlink into your home directory.

When to Contact Apple Support

Open a support case if: fsmonitor daemon crashes repeatedly with kqueue errors in Console.app (indicates a kernel-level filesystem notification bug), Git operations hang indefinitely on APFS volumes with no disk pressure (possible fsck_apfs needed), or Xcode source control crashes the sourcecontrol daemon after enabling core.fsmonitor (signals a framework regression). Provide sysdiagnose output and the exact Git version (git --version --build-options).

FAQ

Why does git status take 30+ seconds on my 200k-file repo? The fsmonitor daemon is likely disabled or crashed. Run git fsmonitor--daemon status; if stopped, restart with git fsmonitor--daemon start. Ensure core.fsmonitor=true is set globally.

Does git maintenance replace manual git gc? Yes. git maintenance run --auto schedules gc, commit-graph write, prefetch, and loose-objects cleanup based on repository size and activity. It’s safer than manual git gc --aggressive, which can bloat packfiles.

Can I use sparse checkout with Xcode? Poorly. Xcode’s project loader expects all referenced files on disk. Sparse checkout hides unpinned directories, causing “file not found” build errors. Either disable sparse checkout for Xcode projects or use git sparse-checkout set to include every folder the project references.

Is the Homebrew Git binary required on Apple Silicon? Strongly recommended. The system /usr/bin/git (currently 2.39.x on macOS 15) lacks fsmonitor--daemon improvements, bundle-uri, and repack --write-bitmap-index optimizations. Homebrew’s 2.45+ is native arm64 and 15-30% faster on large repos.

How do I measure if fixes worked? Run time git status and time git checkout <branch> before and after. Target: git status under 200 ms on a 100k-file repo with fsmonitor warm. Use git count-objects -vH to track packfile count and size — fewer, larger packs indicate healthy repacking.

Neil S
Neil S
Neil is a highly qualified Technical Writer with an M.Sc(IT) degree and an impressive range of IT and Support certifications including MCSE, CCNA, ACA(Adobe Certified Associates), and PG Dip (IT). With over 10 years of hands-on experience as an IT support engineer across Windows, Mac, iOS, and Linux Server platforms, Neil possesses the expertise to create comprehensive and user-friendly documentation that simplifies complex technical concepts for a wide audience.
Watch & Subscribe Our YouTube Channel
YouTube Subscribe Button

Latest From Hawkdive

You May like these Related Articles

blog smart tv privacy apple ecosystem guide 20261102

Smart TV Privacy Risks: Protect Your Apple Ecosystem Data

Stop smart TV tracking on your Apple devices. Learn which TVs respect privacy, how to disable ACR, and secure AirPlay and HomeKit connections.
blog fix chatgpt account takeover iphone security guide 20261101

Fix ChatGPT Account Takeover on iPhone: Security Guide

Secure your ChatGPT account on iPhone after reported takeover risks. Step-by-step fixes for unauthorized access, password reset loops, and Sign in with Apple issues.
blog wii remote mac bluetooth pairing fix 20261031

Nintendo Wii Remote Not Connecting to Mac: Bluetooth Pairing Fixes

Fix Wii Remote Bluetooth pairing failures on Mac. Step-by-step guide for macOS Sequoia, Sonoma, and older versions. Covers sync issues, Dolphin emulator, and Apple Silicon.
blog herdr native app ios fixes login sync crashes 20261030

Herdr Native App Not Working on iOS: Fixes for Login, Sync & Crashes

Herdr iOS app crashing, failing to login, or not syncing? Step-by-step fixes for the new native Mastodon client from Apple Support Community reports.
blog macos 27 battery optimization tips apple silicon 2026 20261030

macOS 27 Battery Optimization Tips for Apple Silicon Macs in 2026

Boost your Mac's battery life with macOS 27 battery optimization tips for Apple Silicon. Learn power management, M4 settings, and how to reduce drain effectively.
blog apple health app not syncing data fix 20261029

Apple Health App Not Syncing Data: Complete Fix Guide

Fix Apple Health app sync issues with step-by-step solutions. Restore activity data, workout records, and iCloud backup across iPhone and Apple Watch.
blog android 16 material you theming customize colors 20261029

Android 16 Material You Theming: Customize Colors Across Apps

Master android 16 material you theming with dynamic colors, wallpaper sync, and per‑app palettes. Step‑by‑step guide to personalize your UI.
blog iphone battery draining fast ios 18 fix 20261028

iPhone Battery Draining Fast After iOS 18 Update Fix

Fix rapid battery drain after iOS 18 update. Step-by-step solutions from Apple Support Community reports and expert troubleshooting.
blog ios 27 live activities sports track real time scores 20261028

iOS 27 Live Activities: Track Sports Scores in Real Time on iPhone

Learn how to use iOS 27 Live Activities to track sports scores in real time on iPhone with setup tips, customization, and battery advice.
blog fix older mac apps wont open after macos update 20261027

Older Mac Apps Won’t Open After macOS Update? Fix Compatibility Issues

Fix older Mac apps that won't launch after updating macOS. Step-by-step solutions for 32-bit, Rosetta 2, and Gatekeeper compatibility problems.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.