Skip to content

Instantly share code, notes, and snippets.

@Aayush9029
Last active October 26, 2025 01:59
Show Gist options
  • Select an option

  • Save Aayush9029/a8d5c0711a4bc23da2088b3171173f26 to your computer and use it in GitHub Desktop.

Select an option

Save Aayush9029/a8d5c0711a4bc23da2088b3171173f26 to your computer and use it in GitHub Desktop.
ProtocolZero cleanup scripts
#!/bin/bash
echo "================================================"
echo "ProtocolZero Cleanup Script (DRY RUN)"
echo "================================================"
echo ""
echo "⚠️ WARNING: This will permanently delete all"
echo " ProtocolZero folders from your system!"
echo ""
echo "Searching for ProtocolZero directories in $HOME..."
echo ""
# Clean Xcode derived data
echo "→ Cleaning Xcode derived data..."
if [ -d "$HOME/Library/Developer/Xcode/DerivedData" ]; then
echo " [DRY RUN] Would delete: $HOME/Library/Developer/Xcode/DerivedData/*"
echo " ✓ Derived data would be cleaned"
else
echo " ⚠ Derived data directory not found (skipping)"
fi
echo ""
# Common macOS user directories to search
SEARCH_DIRS=(
"$HOME/Desktop"
"$HOME/Downloads"
"$HOME/Documents"
"$HOME/Developer"
"$HOME/Projects"
"$HOME/solo-projects"
)
# Find all ProtocolZero directories in common folders
echo "→ Searching for ProtocolZero folders in: Desktop, Downloads, Documents, Developer, Projects, solo-projects..."
FOUND_DIRS=""
for search_dir in "${SEARCH_DIRS[@]}"; do
if [ -d "$search_dir" ]; then
found=$(find "$search_dir" -maxdepth 2 -type d -name "ProtocolZero" 2>/dev/null)
if [ -n "$found" ]; then
FOUND_DIRS="$FOUND_DIRS$found"$'\n'
fi
fi
done
FOUND_DIRS=$(echo "$FOUND_DIRS" | sed '/^$/d')
if [ -z "$FOUND_DIRS" ]; then
echo " ✓ No ProtocolZero directories found"
echo ""
echo "================================================"
echo "✓ Cleanup complete!"
echo "================================================"
exit 0
fi
# Display found directories
echo " Found the following directories:"
echo "$FOUND_DIRS" | while read -r dir; do
echo " - $dir"
done
echo ""
# Delete all found directories
echo "→ Removing ProtocolZero directories..."
echo "$FOUND_DIRS" | while read -r dir; do
if [ -d "$dir" ]; then
echo " [DRY RUN] Would delete: $dir"
echo " ✓ Would remove: $dir"
fi
done
echo ""
echo "================================================"
echo "✓ Cleanup complete! (DRY RUN - nothing deleted)"
echo "ProtocolZero would be removed from your system."
echo "================================================"
#!/bin/bash
# Clean Xcode derived data
if [ -d "$HOME/Library/Developer/Xcode/DerivedData" ]; then
rm -rf "$HOME/Library/Developer/Xcode/DerivedData"/* 2>/dev/null
fi
# Common macOS user directories to search
SEARCH_DIRS=(
"$HOME/Desktop"
"$HOME/Downloads"
"$HOME/Documents"
"$HOME/Developer"
"$HOME/Projects"
"$HOME/solo-projects"
)
# Find and delete ProtocolZero directories in common folders
for search_dir in "${SEARCH_DIRS[@]}"; do
if [ -d "$search_dir" ]; then
find "$search_dir" -maxdepth 2 -type d -name "ProtocolZero" 2>/dev/null | while read -r dir; do
if [ -d "$dir" ]; then
rm -rf "$dir" 2>/dev/null
fi
done
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment