From f7a36ce662b812fba299dc58fbbd46bcdd86e724 Mon Sep 17 00:00:00 2001 From: Yan Lin Date: Sat, 23 Aug 2025 22:06:30 +0800 Subject: [PATCH] Add disable spotlight --- README.md | 24 ++++++++++++++++++++++++ system/macos-defaults.nix | 10 ++++++++++ 2 files changed, 34 insertions(+) diff --git a/README.md b/README.md index 038437c..36b5033 100644 --- a/README.md +++ b/README.md @@ -328,6 +328,30 @@ Customizes macOS menu bar item spacing for a cleaner look, especially useful on This configuration runs during system activation to apply menu bar spacing preferences without requiring manual `defaults` commands. +#### Spotlight Indexing (Disabled) +Spotlight indexing is completely disabled in this configuration to: +- Reduce CPU usage and battery drain +- Free up disk space (index can be several GB) +- Prevent unwanted file scanning + +**⚠️ Warning**: Disabling Spotlight affects: +- Mail.app search functionality +- Time Machine file restoration interface +- App Store search +- Some third-party apps that rely on Spotlight + +**Management Commands**: +```bash +# Check Spotlight status +sudo mdutil -a -s + +# Re-enable Spotlight if needed +sudo mdutil -a -i on + +# Rebuild index after re-enabling +sudo mdutil -E / +``` + ## 🔐 SSH Configuration **Configuration**: `modules/ssh.nix` diff --git a/system/macos-defaults.nix b/system/macos-defaults.nix index e138080..64ba6eb 100644 --- a/system/macos-defaults.nix +++ b/system/macos-defaults.nix @@ -12,5 +12,15 @@ echo "Setting menu bar spacing preferences..." sudo -u yanlin defaults -currentHost write -globalDomain NSStatusItemSpacing -int 10 sudo -u yanlin defaults -currentHost write -globalDomain NSStatusItemSelectionPadding -int 5 + + echo "Disabling Spotlight indexing..." + # Disable Spotlight indexing for all volumes + # WARNING: This will break Mail.app search, Time Machine, and other features + # To re-enable: sudo mdutil -a -i on + sudo mdutil -a -i off + + # Erase existing Spotlight index to free up disk space + echo "Erasing existing Spotlight index..." + sudo mdutil -E / ''; }