Skip to content

Commit 5a8aeb9

Browse files
committed
Add cleanup script for duplicate Safari extension entries
Safari registers each .appex from build artifacts in pluginkit's database, causing duplicate entries in Safari > Settings > Extensions. This happens because the registry auto-discovers extensions in DerivedData, Archives, and build folders. The cleanup script uses `pluginkit -r` to unregister all Cache Status extensions from these locations. Run with `just cleanup-extensions`.
1 parent 09f0827 commit 5a8aeb9

2 files changed

Lines changed: 28 additions & 0 deletions

File tree

Justfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,3 +107,11 @@ dmg version="":
107107
# Build and sign for App Store, then upload manually via Xcode Organizer
108108
release-appstore tag="":
109109
./scripts/archive-appstore.sh {{tag}}
110+
111+
# =============================================================================
112+
# Maintenance
113+
# =============================================================================
114+
115+
# Remove duplicate extensions from Safari (cleans Launch Services)
116+
cleanup-extensions:
117+
./scripts/cleanup-extensions.sh

scripts/cleanup-extensions.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
# Remove duplicate Safari extension registrations from pluginkit
3+
# See: https://keith.github.io/xcode-man-pages/pluginkit.8.html
4+
5+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
6+
PROJECT_DIR="$(dirname "$SCRIPT_DIR")"
7+
8+
echo "Unregistering Cache Status extensions from build artifacts..."
9+
10+
# Remove all .appex registrations from build folders
11+
find "$PROJECT_DIR/build" \
12+
"$HOME/Library/Developer/Xcode/DerivedData" \
13+
"$HOME/Library/Developer/Xcode/Archives" \
14+
-name "*.appex" -path "*Cache*Status*" 2>/dev/null | while read -r path; do
15+
pluginkit -r "$path" 2>/dev/null && echo " Removed: ${path##*/}"
16+
done
17+
18+
echo ""
19+
echo "Duplicates remaining: $(pluginkit -m -D -i com.cfcachestatus.CF-Cache-Status.Extension 2>/dev/null | wc -l | tr -d ' ')"
20+
echo "Restart Safari to apply changes."

0 commit comments

Comments
 (0)