Skip to content

Instantly share code, notes, and snippets.

@flight505
Created November 24, 2025 21:35
Show Gist options
  • Select an option

  • Save flight505/a8c32e2efab5b624997212dae1842d50 to your computer and use it in GitHub Desktop.

Select an option

Save flight505/a8c32e2efab5b624997212dae1842d50 to your computer and use it in GitHub Desktop.
save, chmod +x joycast_cleanup.sh, ./joycast_cleanup.sh
#!/bin/bash
# JoyCast Complete Cleanup Script for macOS
# This script searches for and removes all remnants of JoyCast from your Mac
# Including driver files, preferences, caches, and application support files
set -e # Exit on error
echo "🔍 Starting JoyCast Complete Cleanup..."
echo "================================================"
echo ""
# Define color codes for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Arrays to track findings
declare -a FOUND_FILES=()
declare -a REMOVED_FILES=()
# Function to search and report
search_and_remove() {
local search_path="$1"
local pattern="$2"
local description="$3"
if [ -d "$search_path" ] || [ -f "$search_path" ]; then
echo -e "${BLUE}Searching in: $search_path${NC}"
# Use find with proper error handling
while IFS= read -r file; do
if [ -n "$file" ]; then
FOUND_FILES+=("$file")
echo -e "${YELLOW}Found: $file${NC}"
fi
done < <(find "$search_path" -iname "*$pattern*" 2>/dev/null || true)
fi
}
# 1. Search for HAL driver (the main culprit)
echo -e "${BLUE}Step 1: Checking Audio HAL Drivers${NC}"
echo "---"
search_and_remove "/Library/Audio/Plug-Ins/HAL" "JoyCast" "HAL Driver"
# 2. Search for VST plugins
echo -e "${BLUE}Step 2: Checking VST/Audio Plugins${NC}"
echo "---"
search_and_remove "/Library/Audio/Plug-Ins/VST" "JoyCast" "VST Plugin"
search_and_remove "/Library/Audio/Plug-Ins/VST3" "JoyCast" "VST3 Plugin"
search_and_remove "$HOME/Library/Audio/Plug-Ins/VST" "JoyCast" "User VST Plugin"
search_and_remove "$HOME/Library/Audio/Plug-Ins/VST3" "JoyCast" "User VST3 Plugin"
# 3. Search for preference files (.plist)
echo -e "${BLUE}Step 3: Checking Preference Files${NC}"
echo "---"
search_and_remove "$HOME/Library/Preferences" "JoyCast" "Preferences"
search_and_remove "$HOME/Library/Preferences" "com.joycast" "Preferences"
# 4. Search for application support files
echo -e "${BLUE}Step 4: Checking Application Support${NC}"
echo "---"
search_and_remove "$HOME/Library/Application Support" "JoyCast" "Application Support"
search_and_remove "/Library/Application Support" "JoyCast" "System Application Support"
# 5. Search for caches
echo -e "${BLUE}Step 5: Checking Caches${NC}"
echo "---"
search_and_remove "$HOME/Library/Caches" "JoyCast" "Caches"
search_and_remove "$HOME/Library/Caches" "com.joycast" "Caches"
# 6. Search for saved application state
echo -e "${BLUE}Step 6: Checking Saved Application State${NC}"
echo "---"
search_and_remove "$HOME/Library/Saved Application State" "JoyCast" "Saved State"
# 7. Search in Launch Agents/Daemons
echo -e "${BLUE}Step 7: Checking Launch Agents/Daemons${NC}"
echo "---"
search_and_remove "$HOME/Library/LaunchAgents" "JoyCast" "Launch Agents"
search_and_remove "/Library/LaunchDaemons" "JoyCast" "Launch Daemons"
search_and_remove "/Library/LaunchAgents" "JoyCast" "System Launch Agents"
# 8. Search in Cookies
echo -e "${BLUE}Step 8: Checking Cookies${NC}"
echo "---"
search_and_remove "$HOME/Library/Cookies" "JoyCast" "Cookies"
# Summary before removal
echo ""
echo "================================================"
echo -e "${YELLOW}Total files/folders found: ${#FOUND_FILES[@]}${NC}"
echo ""
if [ ${#FOUND_FILES[@]} -eq 0 ]; then
echo -e "${GREEN}✓ No JoyCast remnants found!${NC}"
echo "Your Mac appears to be clean."
else
echo "Files/folders to be removed:"
echo "---"
for file in "${FOUND_FILES[@]}"; do
echo " • $file"
done
echo ""
# Ask for confirmation
read -p "Do you want to remove these files? (yes/no): " confirm
if [ "$confirm" = "yes" ]; then
echo ""
echo -e "${BLUE}Removing files...${NC}"
for file in "${FOUND_FILES[@]}"; do
if [ -e "$file" ]; then
sudo rm -rf "$file" 2>/dev/null && {
REMOVED_FILES+=("$file")
echo -e "${GREEN}✓ Removed: $file${NC}"
} || {
echo -e "${RED}✗ Failed to remove: $file${NC}"
}
fi
done
echo ""
echo -e "${GREEN}Removed ${#REMOVED_FILES[@]} files/folders${NC}"
# Verification step
echo ""
echo -e "${BLUE}Verifying cleanup...${NC}"
echo "---"
verification_count=0
for file in "${REMOVED_FILES[@]}"; do
if [ ! -e "$file" ]; then
((verification_count++))
fi
done
if [ $verification_count -eq ${#REMOVED_FILES[@]} ]; then
echo -e "${GREEN}✓ All files successfully removed!${NC}"
else
echo -e "${YELLOW}âš Some files may still exist. Manual removal may be needed.${NC}"
fi
else
echo "Removal cancelled."
exit 0
fi
fi
echo ""
echo "================================================"
echo -e "${BLUE}Step 9: Final Verification - Search Results${NC}"
echo "---"
# Final comprehensive search
final_search_count=0
if find /Library/Audio/Plug-Ins/HAL -iname "*JoyCast*" 2>/dev/null | grep -q .; then
echo -e "${RED}âš WARNING: JoyCast.driver still found in HAL${NC}"
find /Library/Audio/Plug-Ins/HAL -iname "*JoyCast*" 2>/dev/null
((final_search_count++))
fi
if find "$HOME/Library" -iname "*joycast*" 2>/dev/null | grep -q .; then
echo -e "${RED}âš WARNING: JoyCast files still found in ~/Library${NC}"
find "$HOME/Library" -iname "*joycast*" 2>/dev/null
((final_search_count++))
fi
if [ $final_search_count -eq 0 ]; then
echo -e "${GREEN}✓ No remaining JoyCast files detected${NC}"
else
echo -e "${YELLOW}âš Some JoyCast traces remain. Additional manual cleanup may be needed.${NC}"
fi
echo ""
echo "================================================"
echo -e "${BLUE}NEXT STEPS:${NC}"
echo "1. Restart your Mac: sudo shutdown -r now"
echo "2. After restart, check System Settings > Sound"
echo "3. Verify MacBook Pro Microphone is available and working"
echo "4. Test recording in a voice memo or similar app"
echo ""
echo -e "${GREEN}Cleanup complete!${NC}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment