Skip to content
Home » Bash Scripts

Bash Scripts

MacOS Bloatware Removal Script

Creating a fully comprehensive script to remove all bloatware and optimize macOS is a complex task and requires a deep understanding of the macOS environment. However, we have provided a simple script below that will remove some typical pre-installed applications and perform a few basic optimizations. Warning: Be sure to back up your data and use this script at your own risk.

Please note that this script may not be compatible with future macOS updates, and some commands may require modification to suit your specific needs. It’s important to review each command before executing the script to ensure it won’t cause any issues on your system.

#!/bin/bash

# Ensure the script is run with sudo privileges
if [ "$(id -u)" != "0" ]; then
    echo "This script must be run with sudo privileges." 1>&2
    exit 1
fi

# Remove default applications
apps_to_remove=(
  "Chess"
  "GarageBand"
  "iMovie"
  "Keynote"
  "Numbers"
  "Pages"
  "Siri"
)

for app in "${apps_to_remove[@]}"; do
    app_path="/Applications/$app.app"
    if [ -d "$app_path" ]; then
        echo "Removing $app..."
        rm -rf "$app_path"
    else
        echo "$app not found, skipping."
    fi
done

# Disable auto-correct
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false

# Disable press-and-hold for keys in favor of key repeat
defaults write -g ApplePressAndHoldEnabled -bool false

# Set a blazing fast keyboard repeat rate
defaults write -g KeyRepeat -int 1
defaults write -g InitialKeyRepeat -int 10

# Show all file extensions in Finder
defaults write -g AppleShowAllExtensions -bool true

# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

# Restart Finder to apply changes
killall Finder

echo "Done. Please restart your computer for all changes to take effect."

Save the script as “remove_bloatware.sh” and make it executable with the following command:

bashCopy codechmod +x remove_bloatware.sh

Run the script with sudo privileges:

bashCopy codesudo ./remove_bloatware.sh

Remember that this script is just a starting point, and you might need to customize it depending on your needs and the specific macOS version you’re using.

Leave a Reply

Your email address will not be published. Required fields are marked *