echo “π Starting the ultimate macOS setup script with all requested features…”
--------------------------------------
π Enable Passwordless Sudo
--------------------------------------
echo “π Enabling passwordless sudo for the current user…”
USER=$(whoami)
SUDOERS_FILE=”/etc/sudoers.d/$USER”
if [ ! -f “$SUDOERS_FILE” ]; then
echo “$USER ALL=(ALL) NOPASSWD: ALL” | sudo tee “$SUDOERS_FILE” >/dev/null
sudo chmod 0440 “$SUDOERS_FILE”
echo “β
Passwordless sudo enabled for $USER!”
else
echo “β
Passwordless sudo is already configured for $USER!”
fi
Extend sudo timeout to 60 minutes
echo “Defaults timestamp_timeout=60” | sudo tee /etc/sudoers.d/timestamp_timeout >/dev/null
echo “β²οΈ Sudo timeout extended to 60 minutes!”
--------------------------------------
π₯ Install Homebrew (if not installed)
--------------------------------------
echo “π Checking Homebrew installation…”
if [[ ! -f /opt/homebrew/bin/brew ]]; then
echo “β οΈ Homebrew is missing! Installing Homebrew…”
/bin/bash -c “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)” || {
echo “β Failed to install Homebrew. Exiting…”
exit 1
}
else
echo “β
Homebrew is already installed!”
fi
export PATH=”/opt/homebrew/bin:$PATH”
--------------------------------------
π₯ Install Zenity
--------------------------------------
echo “π₯ Installing Zenity for interactive dialogs…”
if ! brew list zenity &>/dev/null; then
brew install zenity || {
echo “β Failed to install Zenity. Continuing…”
}
else
echo “β
Zenity is already installed!”
fi
--------------------------------------
πΊ Install VLC, Google Chrome, and Termius
--------------------------------------
echo “πΊ Installing VLC, Google Chrome, and Termius…”
for app in vlc google-chrome termius; do
if ! brew list –cask “$app” &>/dev/null; then
brew install –cask “$app” || {
echo “β Failed to install $app. Continuing…”
}
else
echo “β
$app is already installed!”
fi
done
--------------------------------------
π Enable Find My Mac
--------------------------------------
echo “π Enabling Find My Mac…”
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locationd.plist
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.findmymac.plist
echo “β
Find My Mac enabled!”
--------------------------------------
π¬ Enable iMessage
--------------------------------------
echo “π¬ Enabling iMessage…”
defaults write com.apple.messageshelper.AccountInfoController Enabled -bool true
echo “β
iMessage enabled! Please sign in manually to complete setup.”
--------------------------------------
β Enable Unlock with Apple Watch
--------------------------------------
echo “β Enabling Unlock with Apple Watch…”
defaults write com.apple.controlcenter “NSStatusItem Visible UnlockWithWatch” -bool true
echo “β
Unlock with Apple Watch enabled! Ensure your devices are paired and signed into the same iCloud account.”
--------------------------------------
π Enable Universal Control
--------------------------------------
echo “π Enabling Universal Control…”
defaults write com.apple.universalaccess “UniversalControlAllowCursorKeyboard” -bool true
defaults write com.apple.universalaccess “UniversalControlEdgeConnection” -bool true
defaults write com.apple.universalaccess “UniversalControlMultideviceConnection” -bool true
defaults write com.apple.sidecar.display “DisplayStatusMode” -string “always”
killall System\ Preferences
echo “β
Universal Control fully enabled!”
echo “π To link your keyboard and mouse to other Macs using Universal Control:”
echo “1. Open System Settings on all Macs.”
echo “2. Go to ‘Displays’.”
echo “3. Click on ‘Add Display’ and select the other Mac.”
echo “4. Arrange the displays as needed.”
echo “5. Ensure ‘Allow your pointer and keyboard to move between any nearby Mac or iPad’ is enabled.”
echo “6. Check ‘Push through the edge of a display to connect to a nearby Mac or iPad’.”
echo “β οΈ This step must be done manually for security reasons.”
--------------------------------------
π Enable Bluetooth
--------------------------------------
echo “π Enabling Bluetooth…”
sudo defaults write /Library/Preferences/com.apple.Bluetooth ControllerPowerState -int 1
sudo killall bluetoothd
echo “β
Bluetooth enabled!”
--------------------------------------
π Increase CPU Performance
--------------------------------------
echo “π Enabling High Performance Mode…”
sudo pmset -a hibernatemode 0
sudo pmset -a standby 0
sudo pmset -a autopoweroff 0
sudo pmset -a displaysleep 0
sudo pmset -a sleep 0
sudo pmset -a powernap 0
echo “β
High performance settings applied!”
--------------------------------------
π£ Set Background to Purple
--------------------------------------
echo “π£ Setting desktop background to purple…”
osascript -e ‘tell application “System Events” to set picture of every desktop to (POSIX file “/System/Library/Desktop Pictures/Solid Colors/Purple 1.png”)’
echo “β
Desktop background changed to purple!”
--------------------------------------
π Reset and Customize Dock
--------------------------------------
echo “π Resetting and Customizing Dock…”
defaults delete com.apple.dock persistent-apps
defaults delete com.apple.dock persistent-others
defaults write com.apple.dock tilesize -int 36
defaults write com.apple.dock autohide -bool false
defaults write com.apple.dock show-recents -bool false
killall Dock
echo “β
Dock customized!”
--------------------------------------
π Verification of All Components
--------------------------------------
echo “π Verifying all installed components…”
echo “Google Chrome installed: $(brew list –cask | grep google-chrome)”
echo “Termius installed: $(brew list –cask | grep termius)”
echo “VLC installed: $(brew list –cask | grep vlc)”
echo “Bluetooth status: $(system_profiler SPBluetoothDataType | grep ‘State: On’)”
echo “Find My Mac enabled: $(sudo defaults read /Library/Preferences/com.apple.FindMyMac.plist)”
echo “Universal Control enabled: $(defaults read com.apple.universalaccess UniversalControlAllowCursorKeyboard)”
echo “π Script completed successfully with all features verified!”
!/bin/bash
!/bin/bash
π macOS Optimization Script with Full Cloud Sync, Progress Display in Zenity, and File Streaming
echo “π Starting macOS Optimization…”
β Logging function
log() { echo -e “\033[0;32m[β] $1\033[0m”; }
error() { echo -e “\033[0;31m[β] $1\033[0m”; exit 1; }
β Ensure the script is run as root
if [[ $EUID -ne 0 ]]; then
error “β οΈ Please run this script as root using sudo”
fi
β Enable iCloud Optimized Storage (Offload Unused Files)
enable_icloud_optimization() {
log “βοΈ Enabling iCloud Optimized Storage…”
sudo defaults write ~/Library/Preferences/com.apple.bird optimizeStorage -bool true
killall bird
log “β
iCloud Optimized Storage Enabled!”
}
β Configure Google Drive to Stream Files
setup_google_drive_streaming() {
log “π Setting Google Drive to Stream Mode…”
open -a “Google Drive”
log “β
Ensure Google Drive is set to ‘Stream files’ mode in Preferences!”
}
β Sync All Files and Show Progress in Zenity
sync_files() {
log “π Starting Full Sync of iCloud Drive and Google Drive…”
SYNC_SOURCE=~/
ICLOUD_DEST=~/Library/Mobile\ Documents/com~apple~CloudDocs/
GOOGLE_DRIVE_DEST=~/GoogleDrive/
(rsync -av --progress "$SYNC_SOURCE" "$ICLOUD_DEST" | tee /tmp/icloud_sync.log) | zenity --progress --title="Syncing to iCloud Drive" --text="Syncing files..." --pulsate --auto-close --width=400
(rsync -av --progress "$SYNC_SOURCE" "$GOOGLE_DRIVE_DEST" | tee /tmp/google_drive_sync.log) | zenity --progress --title="Syncing to Google Drive" --text="Syncing files..." --pulsate --auto-close --width=400
log "β
Full Sync Completed!"
}
β List Available Files for Download (Not Stored Locally)
list_cloud_files() {
log “π Listing available files in iCloud and Google Drive…”
find ~/Library/Mobile\ Documents/com~apple~CloudDocs/ -type f > /tmp/icloud_files.txt
find ~/GoogleDrive/ -type f >> /tmp/google_drive_files.txt
cat /tmp/icloud_files.txt /tmp/google_drive_files.txt > /tmp/all_cloud_files.txt
zenity –list –title=”Cloud Files” –text=”Select a file to download” –column=”File” –filename=/tmp/all_cloud_files.txt –width=600 –height=400
}
β Download Selected File from Cloud
download_file() {
FILE=$(zenity –file-selection –title=”Select file to download”)
if [ -f “$FILE” ]; then
log “β¬οΈ Downloading $FILE…”
open “$FILE”
log “β
File downloaded successfully!”
else
error “β File not found in cloud storage!”
fi
}
β Run Selected Features
task_list=(“enable_icloud_optimization” “setup_google_drive_streaming” “sync_files” “list_cloud_files” “download_file”)
for task in “${task_list[@]}”; do
$task &
done
log “π All Tasks Completed Successfully!”
!/bin/bash
echo “π§ Forcing All macOS Apps to Think They Are Running on a 4K Display (Permanent Fix)…”
β Enable HiDPI Mode for Retina-Like Scaling on 1920x1080
echo “π₯ Enabling HiDPI Scaling…”
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayHiDPIEnabled -bool true
sudo defaults write /Library/Preferences/com.apple.windowserver ExternalDisplayHIDPIEnabled -bool true
β Trick macOS intoΓ₯ Reporting a 4K Display (Without Modifying App Info.plist)
echo “π₯ Setting macOS to Report a 4K Display (3840x2160)…”
sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionWidth -int 3840
sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionHeight -int 2160
β Reduce UI Scaling for a Compact 4K-Like Experience
echo “π Making macOS UI Smaller…”
defaults write -g AppleGlobalTextScalingFactor -float 0.35 # Shrinks UI system-wide
β Make Fonts Smaller for More Screen Space
echo “π€ Reducing System Font Size…”
defaults write -g AppleFontSmoothing -int 1 # Lighter font smoothing for sharp edges
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO # Ensure clear text
defaults write -g NSFontSize -int 9 # Smallest readable font size
β Reduce Finder Sidebar & Icons for a Compact UI
echo “π Making Finder Compact…”
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1
defaults write com.apple.finder FXPreferredViewStyle -string “Nlsv”
defaults write com.apple.finder StandardViewSettings -dict-add “IconSize” -int 10
β Shrink Dock to Free Up Space
echo “π Making Dock Ultra-Compact…”
defaults write com.apple.dock tilesize -int 10
defaults write com.apple.dock autohide -bool true
β Reduce Transparency for a Sharper UI
echo “π₯ Disabling Transparency for a Crisper Display…”
defaults write com.apple.universalaccess reduceTransparency -bool true
β Force Full RGB Mode for External Displays (Fix Blurry Text & Colors)
echo “π¨ Enforcing Full RGB Mode…”
defaults write -g AppleFontSmoothing -int 1
β Reduce Window Shadows for a Cleaner Look
echo “π Removing Window Shadows…”
defaults write com.apple.universalaccess reduceMotion -bool true
β Interactive GUI Selection
CHOICES=$(zenity –list –title “macOS 4K Optimization” –text “Select Features to Apply” –checklist –column “Select” –column “Feature” \
TRUE “Enable HiDPI Scaling” \
TRUE “Set macOS to Report 4K Display” \
TRUE “Reduce UI Scaling” \
TRUE “Reduce Font Size” \
TRUE “Compact Finder UI” \
TRUE “Shrink Dock” \
TRUE “Disable Transparency” \
TRUE “Enforce Full RGB Mode” \
TRUE “Reduce Window Shadows” \
–separator=”:” 2>/dev/null)
β Process User Choices
IFS=”:” read -ra SELECTED <<< “$CHOICES”
for CHOICE in “${SELECTED[@]}”; do
case “$CHOICE” in
“Enable HiDPI Scaling”)
sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayHiDPIEnabled -bool true
sudo defaults write /Library/Preferences/com.apple.windowserver ExternalDisplayHIDPIEnabled -bool true
;;
“Set macOS to Report 4K Display”)
sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionWidth -int 3840
sudo defaults write /Library/Preferences/com.apple.windowserver.plist DisplayResolutionHeight -int 2160
;;
“Reduce UI Scaling”)
defaults write -g AppleGlobalTextScalingFactor -float 0.35
;;
“Reduce Font Size”)
defaults write -g AppleFontSmoothing -int 1
defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO
defaults write -g NSFontSize -int 9
;;
“Compact Finder UI”)
defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1
defaults write com.apple.finder FXPreferredViewStyle -string “Nlsv”
defaults write com.apple.finder StandardViewSettings -dict-add “IconSize” -int 10
;;
“Shrink Dock”)
defaults write com.apple.dock tilesize -int 10
defaults write com.apple.dock autohide -bool true
;;
“Disable Transparency”)
defaults write com.apple.universalaccess reduceTransparency -bool true
;;
“Enforce Full RGB Mode”)
defaults write -g AppleFontSmoothing -int 1
;;
“Reduce Window Shadows”)
defaults write com.apple.universalaccess reduceMotion -bool true
;;
esac
done
β Restart macOS UI to Apply Changes
echo “π Restarting macOS UI Services…”
killall Finder && killall Dock && killall SystemUIServer
echo “β macOS UI Now Optimized for 4K Scaling on 1920x1080 HiDPI!”