···1414 system.activationScripts.postActivation.text = lib.mkAfter ''
1515 echo "Rebuilding Launch Services database..." >&2
16161717- # Clear and rebuild the Launch Services database
1717+ # Modern approach: garbage collect and rescan all domains
1818 # This ensures all Nix apps are properly registered with macOS
1919+ # Using -gc (garbage collect) instead of deprecated -kill flag
1920 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister \
2020- -kill -r -domain local -domain system -domain user
2121+ -gc -R -apps u,s,l 2>/dev/null || true
21222223 # Reset Launchpad cache to show updated apps
2324 # This is necessary for apps to appear in Spotlight and Launchpad
2425 find /private/var/folders/ -type d -name com.apple.dock.launchpad -exec rm -rf {} + 2>/dev/null || true
25262627 # Restart Dock to apply changes
2727- killall Dock || true
2828+ killall Dock 2>/dev/null || true
28292930 echo "Launch Services database rebuilt successfully" >&2
3031 '';