# Attempt to remove Homebrew directories and files echo "Removing Homebrew directories and files..." let homebrew_dirs = ["/usr/local/Cellar" "/usr/local/Homebrew" "~/.cache/Homebrew" "~/Library/Caches/Homebrew" "~/Library/Logs/Homebrew" "/usr/local/Caskroom" "/opt/homebrew" ] for dir in $homebrew_dirs { if ($dir | path exists) { # rm -rfv $dir let to_remove = $dir | str replace '~' $env.HOME echo $to_remove ^sudo rm -r $to_remove # if ($? == 0) { # echo "File successfully removed" # } else { # echo "Failed to remove file" # } echo $"Removed: ($dir)" } } echo "Homebrew cleanup process is complete."