Initial commit: Complete macOS dotfiles system
🖖 Features: - Master 'engage' script for one-command setup - 120+ CLI tools via Homebrew - 40+ Applications (casks + MAS apps) - Complete macOS system configuration - Security hardening and privacy settings - Obsidian knowledge vault setup - Comprehensive backup strategies - Automated symlink management Live long and prosper\! 🚀 🤖 Generated with Claude Code (https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
+144
@@ -0,0 +1,144 @@
|
||||
# macOS System Configuration
|
||||
|
||||
This directory contains scripts to configure macOS system preferences, security settings, and keyboard shortcuts.
|
||||
|
||||
## Scripts Overview
|
||||
|
||||
### Main Scripts
|
||||
- `setup-macos.sh` - Master script that runs all configurations
|
||||
- `defaults.sh` - Complete system defaults (automatic)
|
||||
- `defaults-interactive.sh` - Interactive system defaults
|
||||
- `security.sh` - Security and privacy settings
|
||||
- `keyboard-shortcuts.sh` - Custom keyboard shortcuts
|
||||
|
||||
### Utility Scripts
|
||||
- `backup-defaults.sh` - Backup current settings before changes
|
||||
|
||||
## Quick Start
|
||||
|
||||
Run the master setup script:
|
||||
```bash
|
||||
~/dotfiles/macos/setup-macos.sh
|
||||
```
|
||||
|
||||
This will:
|
||||
1. Offer to backup current settings
|
||||
2. Let you choose how to apply defaults
|
||||
3. Configure security settings
|
||||
4. Set up keyboard shortcuts
|
||||
|
||||
## Individual Scripts
|
||||
|
||||
### System Defaults
|
||||
```bash
|
||||
# Interactive mode (recommended)
|
||||
~/dotfiles/macos/defaults-interactive.sh
|
||||
|
||||
# Apply all at once
|
||||
~/dotfiles/macos/defaults.sh
|
||||
```
|
||||
|
||||
### Security Settings
|
||||
```bash
|
||||
~/dotfiles/macos/security.sh
|
||||
```
|
||||
|
||||
### Backup Current Settings
|
||||
```bash
|
||||
~/dotfiles/macos/backup-defaults.sh
|
||||
```
|
||||
|
||||
## What Gets Configured
|
||||
|
||||
### System Defaults
|
||||
- **General UI/UX**: Save panels, auto-correct, smart quotes
|
||||
- **Keyboard**: Key repeat, full keyboard access
|
||||
- **Trackpad**: Tap to click, gestures
|
||||
- **Finder**: Show extensions, path bar, status bar, search settings
|
||||
- **Dock**: Position, size, animations, auto-hide
|
||||
- **Screen**: Screenshots location/format, screen saver
|
||||
- **Safari**: Developer tools, privacy, security
|
||||
- **Other apps**: Mail, Terminal, Activity Monitor, TextEdit
|
||||
|
||||
### Security Settings
|
||||
- Screen lock immediately after sleep
|
||||
- Firewall enabled with stealth mode
|
||||
- Disable analytics and tracking
|
||||
- Secure Safari settings
|
||||
- Disable unnecessary services
|
||||
- Gatekeeper enabled
|
||||
- FileVault check
|
||||
|
||||
### Keyboard Shortcuts
|
||||
- Mission Control shortcuts
|
||||
- App-specific shortcuts
|
||||
- Custom service shortcuts
|
||||
|
||||
## Customization
|
||||
|
||||
### Modifying Defaults
|
||||
Edit the scripts to match your preferences:
|
||||
- Dock position: Change `orientation` value
|
||||
- Key repeat speed: Adjust `KeyRepeat` and `InitialKeyRepeat`
|
||||
- Screenshot location: Modify `screencapture location`
|
||||
|
||||
### Adding New Settings
|
||||
1. Find the setting: `defaults read domain`
|
||||
2. Test the change: `defaults write domain key value`
|
||||
3. Add to appropriate script
|
||||
4. Test with a backup
|
||||
|
||||
### Useful Commands
|
||||
```bash
|
||||
# Find current setting
|
||||
defaults read com.apple.dock orientation
|
||||
|
||||
# Test a change
|
||||
defaults write com.apple.dock tilesize -int 64
|
||||
|
||||
# Reset to default
|
||||
defaults delete com.apple.dock tilesize
|
||||
|
||||
# List all domains
|
||||
defaults domains
|
||||
|
||||
# Read entire domain
|
||||
defaults read com.apple.dock
|
||||
```
|
||||
|
||||
## Manual Configuration Still Required
|
||||
|
||||
Some settings must be configured manually:
|
||||
1. **System Preferences > Security & Privacy**
|
||||
- FileVault encryption
|
||||
- App permissions (Camera, Microphone, etc.)
|
||||
- Privacy settings
|
||||
|
||||
2. **System Preferences > Keyboard > Shortcuts**
|
||||
- Some Mission Control shortcuts
|
||||
- Service shortcuts
|
||||
|
||||
3. **App-specific settings**
|
||||
- Third-party app preferences
|
||||
- Login items
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
### Settings Not Taking Effect
|
||||
- Some changes require logout/restart
|
||||
- Try: `killall SystemUIServer` or `killall Dock`
|
||||
- Clear preferences cache: `killall cfprefsd`
|
||||
|
||||
### Backing Out Changes
|
||||
- Restore from backup: Run backup script first
|
||||
- Reset specific domains: `defaults delete domain`
|
||||
- System reset: System Preferences > General > Reset
|
||||
|
||||
### Finding Setting Names
|
||||
- Use GUI first, then check `defaults domains`
|
||||
- Monitor changes: `defaults read domain > before.txt`, make change, `defaults read domain > after.txt`, `diff before.txt after.txt`
|
||||
|
||||
## References
|
||||
- [macOS defaults reference](https://macos-defaults.com/)
|
||||
- [Awesome macOS Command Line](https://github.com/herrbischoff/awesome-macos-command-line)
|
||||
- [macOS Security Guide](https://github.com/drduh/macOS-Security-and-Privacy-Guide)
|
||||
Executable
+70
@@ -0,0 +1,70 @@
|
||||
#!/usr/bin/env bash
|
||||
# Backup current macOS defaults before applying new ones
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
BACKUP_DIR="$HOME/dotfiles/macos/backups"
|
||||
TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||
BACKUP_FILE="$BACKUP_DIR/defaults_backup_${TIMESTAMP}.txt"
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${GREEN}Backing up current macOS defaults...${NC}"
|
||||
|
||||
# Create backup directory
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
# Domains to backup
|
||||
domains=(
|
||||
"NSGlobalDomain"
|
||||
"com.apple.dock"
|
||||
"com.apple.finder"
|
||||
"com.apple.Safari"
|
||||
"com.apple.screencapture"
|
||||
"com.apple.screensaver"
|
||||
"com.apple.ActivityMonitor"
|
||||
"com.apple.TextEdit"
|
||||
)
|
||||
|
||||
# Backup each domain
|
||||
{
|
||||
echo "# macOS Defaults Backup"
|
||||
echo "# Created: $(date)"
|
||||
echo "# System: $(sw_vers -productVersion)"
|
||||
echo ""
|
||||
} > "$BACKUP_FILE"
|
||||
|
||||
for domain in "${domains[@]}"; do
|
||||
echo -e "${YELLOW}Backing up $domain...${NC}"
|
||||
{
|
||||
echo "# ============================================="
|
||||
echo "# $domain"
|
||||
echo "# ============================================="
|
||||
defaults read "$domain" 2>/dev/null || echo "# No settings found for $domain"
|
||||
echo ""
|
||||
} >> "$BACKUP_FILE"
|
||||
done
|
||||
|
||||
# Backup specific important settings
|
||||
echo -e "${YELLOW}Backing up specific settings...${NC}"
|
||||
{
|
||||
echo "# ============================================="
|
||||
echo "# Specific Settings"
|
||||
echo "# ============================================="
|
||||
echo "# Dock position: $(defaults read com.apple.dock orientation 2>/dev/null || echo 'default')"
|
||||
echo "# Dock size: $(defaults read com.apple.dock tilesize 2>/dev/null || echo 'default')"
|
||||
echo "# Show hidden files: $(defaults read com.apple.finder AppleShowAllFiles 2>/dev/null || echo 'false')"
|
||||
echo "# Key repeat: $(defaults read NSGlobalDomain KeyRepeat 2>/dev/null || echo 'default')"
|
||||
echo "# Initial key repeat: $(defaults read NSGlobalDomain InitialKeyRepeat 2>/dev/null || echo 'default')"
|
||||
} >> "$BACKUP_FILE"
|
||||
|
||||
echo -e "${GREEN}✓ Backup saved to: $BACKUP_FILE${NC}"
|
||||
|
||||
# Keep only last 5 backups
|
||||
cd "$BACKUP_DIR"
|
||||
ls -t defaults_backup_*.txt 2>/dev/null | tail -n +6 | xargs -r rm
|
||||
|
||||
echo -e "${GREEN}Backup complete!${NC}"
|
||||
Executable
+195
@@ -0,0 +1,195 @@
|
||||
#!/usr/bin/env bash
|
||||
# Interactive macOS defaults setter
|
||||
# Choose which categories to apply
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
RED='\033[0;31m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${BLUE}macOS Defaults Configuration${NC}"
|
||||
echo "=============================="
|
||||
echo "Select which settings to apply:"
|
||||
echo ""
|
||||
|
||||
# Ask for sudo upfront
|
||||
sudo -v
|
||||
|
||||
# Function to ask yes/no
|
||||
ask() {
|
||||
while true; do
|
||||
read -p "$1 (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
return 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# General UI/UX
|
||||
if ask "Apply General UI/UX settings?"; then
|
||||
echo -e "${YELLOW}Applying General UI/UX settings...${NC}"
|
||||
|
||||
# Expand save/print panels by default
|
||||
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
|
||||
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
|
||||
|
||||
# Save to disk by default
|
||||
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
|
||||
|
||||
# Disable auto-correct and substitutions
|
||||
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
|
||||
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
|
||||
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
|
||||
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
|
||||
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
|
||||
|
||||
echo -e "${GREEN}✓ General UI/UX settings applied${NC}"
|
||||
fi
|
||||
|
||||
# Keyboard & Input
|
||||
if ask "Apply Keyboard settings?"; then
|
||||
echo -e "${YELLOW}Applying Keyboard settings...${NC}"
|
||||
|
||||
# Enable full keyboard access
|
||||
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
|
||||
|
||||
# Fast key repeat
|
||||
defaults write NSGlobalDomain KeyRepeat -int 2
|
||||
defaults write NSGlobalDomain InitialKeyRepeat -int 15
|
||||
|
||||
# Disable press-and-hold
|
||||
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
|
||||
|
||||
echo -e "${GREEN}✓ Keyboard settings applied${NC}"
|
||||
fi
|
||||
|
||||
# Finder
|
||||
if ask "Apply Finder settings?"; then
|
||||
echo -e "${YELLOW}Applying Finder settings...${NC}"
|
||||
|
||||
# Show extensions, status bar, path bar
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
defaults write com.apple.finder ShowStatusBar -bool true
|
||||
defaults write com.apple.finder ShowPathbar -bool true
|
||||
|
||||
# Keep folders on top
|
||||
defaults write com.apple.finder _FXSortFoldersFirst -bool true
|
||||
|
||||
# Search current folder by default
|
||||
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
|
||||
|
||||
# Disable extension change warning
|
||||
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
|
||||
|
||||
# Show Library folder
|
||||
chflags nohidden ~/Library
|
||||
|
||||
echo -e "${GREEN}✓ Finder settings applied${NC}"
|
||||
fi
|
||||
|
||||
# Dock
|
||||
if ask "Apply Dock settings?"; then
|
||||
echo -e "${YELLOW}Which Dock position?${NC}"
|
||||
echo "1) Left"
|
||||
echo "2) Bottom"
|
||||
echo "3) Right"
|
||||
read -p "Choice (1-3): " -n 1 -r
|
||||
echo
|
||||
|
||||
case $REPLY in
|
||||
1) position="left";;
|
||||
2) position="bottom";;
|
||||
3) position="right";;
|
||||
*) position="right";;
|
||||
esac
|
||||
|
||||
defaults write com.apple.dock orientation -string "$position"
|
||||
|
||||
# Other Dock settings
|
||||
defaults write com.apple.dock tilesize -int 48
|
||||
defaults write com.apple.dock minimize-to-application -bool true
|
||||
defaults write com.apple.dock show-process-indicators -bool true
|
||||
defaults write com.apple.dock launchanim -bool false
|
||||
defaults write com.apple.dock autohide -bool true
|
||||
defaults write com.apple.dock autohide-delay -float 0
|
||||
defaults write com.apple.dock show-recents -bool false
|
||||
|
||||
echo -e "${GREEN}✓ Dock settings applied${NC}"
|
||||
fi
|
||||
|
||||
# Security
|
||||
if ask "Apply Security settings?"; then
|
||||
echo -e "${YELLOW}Applying Security settings...${NC}"
|
||||
|
||||
# Require password immediately after sleep
|
||||
defaults write com.apple.screensaver askForPassword -int 1
|
||||
defaults write com.apple.screensaver askForPasswordDelay -int 0
|
||||
|
||||
echo -e "${GREEN}✓ Security settings applied${NC}"
|
||||
fi
|
||||
|
||||
# Screenshots
|
||||
if ask "Apply Screenshot settings?"; then
|
||||
echo -e "${YELLOW}Where should screenshots be saved?${NC}"
|
||||
echo "1) Desktop (default)"
|
||||
echo "2) Pictures/Screenshots"
|
||||
echo "3) Downloads"
|
||||
read -p "Choice (1-3): " -n 1 -r
|
||||
echo
|
||||
|
||||
case $REPLY in
|
||||
2)
|
||||
mkdir -p ~/Pictures/Screenshots
|
||||
location="$HOME/Pictures/Screenshots"
|
||||
;;
|
||||
3)
|
||||
location="$HOME/Downloads"
|
||||
;;
|
||||
*)
|
||||
location="$HOME/Desktop"
|
||||
;;
|
||||
esac
|
||||
|
||||
defaults write com.apple.screencapture location -string "$location"
|
||||
defaults write com.apple.screencapture type -string "png"
|
||||
defaults write com.apple.screencapture disable-shadow -bool true
|
||||
|
||||
echo -e "${GREEN}✓ Screenshot settings applied${NC}"
|
||||
fi
|
||||
|
||||
# Development Tools
|
||||
if ask "Apply Development settings (Safari, Terminal)?"; then
|
||||
echo -e "${YELLOW}Applying Development settings...${NC}"
|
||||
|
||||
# Safari
|
||||
defaults write com.apple.Safari IncludeDevelopMenu -bool true
|
||||
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
|
||||
|
||||
# Terminal
|
||||
defaults write com.apple.terminal StringEncodings -array 4
|
||||
defaults write com.apple.terminal SecureKeyboardEntry -bool true
|
||||
|
||||
echo -e "${GREEN}✓ Development settings applied${NC}"
|
||||
fi
|
||||
|
||||
# Restart affected apps
|
||||
if ask "Restart affected applications?"; then
|
||||
echo -e "${YELLOW}Restarting applications...${NC}"
|
||||
|
||||
for app in "Dock" "Finder" "SystemUIServer"; do
|
||||
killall "${app}" &> /dev/null || true
|
||||
done
|
||||
|
||||
echo -e "${GREEN}✓ Applications restarted${NC}"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}Configuration complete!${NC}"
|
||||
echo "Some changes may require logging out or restarting."
|
||||
Executable
+287
@@ -0,0 +1,287 @@
|
||||
#!/usr/bin/env bash
|
||||
# macOS System Preferences
|
||||
# Tested on macOS Sonoma/Sequoia
|
||||
# Run: bash ~/dotfiles/macos/defaults.sh
|
||||
|
||||
# Close System Preferences to prevent conflicts
|
||||
osascript -e 'tell application "System Preferences" to quit'
|
||||
|
||||
# Ask for administrator password upfront
|
||||
sudo -v
|
||||
|
||||
# Keep sudo alive
|
||||
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
|
||||
|
||||
echo "Setting macOS defaults..."
|
||||
|
||||
# =============================================================================
|
||||
# General UI/UX
|
||||
# =============================================================================
|
||||
|
||||
# Expand save panel by default
|
||||
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
|
||||
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
|
||||
|
||||
# Expand print panel by default
|
||||
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
|
||||
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
|
||||
|
||||
# Save to disk (not iCloud) by default
|
||||
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
|
||||
|
||||
# Automatically quit printer app once print jobs complete
|
||||
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
|
||||
|
||||
# Disable Resume system-wide
|
||||
defaults write com.apple.systempreferences NSQuitAlwaysKeepsWindows -bool false
|
||||
|
||||
# Disable automatic capitalization
|
||||
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
|
||||
|
||||
# Disable smart dashes
|
||||
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
|
||||
|
||||
# Disable automatic period substitution
|
||||
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
|
||||
|
||||
# Disable smart quotes
|
||||
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
|
||||
|
||||
# Disable auto-correct
|
||||
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
|
||||
|
||||
# =============================================================================
|
||||
# Trackpad, Mouse, Keyboard
|
||||
# =============================================================================
|
||||
|
||||
# Trackpad: enable tap to click
|
||||
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
|
||||
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
|
||||
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
|
||||
|
||||
# Enable full keyboard access for all controls
|
||||
defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
|
||||
|
||||
# Use scroll gesture with the Ctrl (^) modifier key to zoom
|
||||
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
|
||||
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
|
||||
|
||||
# Disable press-and-hold for keys in favor of key repeat
|
||||
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
|
||||
|
||||
# Set fast keyboard repeat rate
|
||||
defaults write NSGlobalDomain KeyRepeat -int 2
|
||||
defaults write NSGlobalDomain InitialKeyRepeat -int 15
|
||||
|
||||
# =============================================================================
|
||||
# Screen
|
||||
# =============================================================================
|
||||
|
||||
# Require password immediately after sleep or screen saver
|
||||
defaults write com.apple.screensaver askForPassword -int 1
|
||||
defaults write com.apple.screensaver askForPasswordDelay -int 0
|
||||
|
||||
# Save screenshots to the desktop
|
||||
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
|
||||
|
||||
# Save screenshots in PNG format
|
||||
defaults write com.apple.screencapture type -string "png"
|
||||
|
||||
# Disable shadow in screenshots
|
||||
defaults write com.apple.screencapture disable-shadow -bool true
|
||||
|
||||
# =============================================================================
|
||||
# Finder
|
||||
# =============================================================================
|
||||
|
||||
# Finder: show all filename extensions
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
|
||||
# Finder: show status bar
|
||||
defaults write com.apple.finder ShowStatusBar -bool true
|
||||
|
||||
# Finder: show path bar
|
||||
defaults write com.apple.finder ShowPathbar -bool true
|
||||
|
||||
# Keep folders on top when sorting by name
|
||||
defaults write com.apple.finder _FXSortFoldersFirst -bool true
|
||||
|
||||
# When performing a search, search the current folder by default
|
||||
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
|
||||
|
||||
# Disable the warning when changing a file extension
|
||||
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
|
||||
|
||||
# Enable spring loading for directories
|
||||
defaults write NSGlobalDomain com.apple.springing.enabled -bool true
|
||||
|
||||
# Avoid creating .DS_Store files on network or USB volumes
|
||||
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
|
||||
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
|
||||
|
||||
# Use list view in all Finder windows by default
|
||||
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
|
||||
|
||||
# Show the ~/Library folder
|
||||
chflags nohidden ~/Library
|
||||
|
||||
# Show the /Volumes folder
|
||||
sudo chflags nohidden /Volumes
|
||||
|
||||
# =============================================================================
|
||||
# Dock
|
||||
# =============================================================================
|
||||
|
||||
# Set Dock position (left, bottom, right)
|
||||
defaults write com.apple.dock orientation -string "right"
|
||||
|
||||
# Set the icon size of Dock items
|
||||
defaults write com.apple.dock tilesize -int 48
|
||||
|
||||
# Change minimize/maximize window effect
|
||||
defaults write com.apple.dock mineffect -string "scale"
|
||||
|
||||
# Minimize windows into their application's icon
|
||||
defaults write com.apple.dock minimize-to-application -bool true
|
||||
|
||||
# Show indicator lights for open applications
|
||||
defaults write com.apple.dock show-process-indicators -bool true
|
||||
|
||||
# Don't animate opening applications from the Dock
|
||||
defaults write com.apple.dock launchanim -bool false
|
||||
|
||||
# Speed up Mission Control animations
|
||||
defaults write com.apple.dock expose-animation-duration -float 0.1
|
||||
|
||||
# Don't automatically rearrange Spaces based on most recent use
|
||||
defaults write com.apple.dock mru-spaces -bool false
|
||||
|
||||
# Remove the auto-hiding Dock delay
|
||||
defaults write com.apple.dock autohide-delay -float 0
|
||||
|
||||
# Remove the animation when hiding/showing the Dock
|
||||
defaults write com.apple.dock autohide-time-modifier -float 0
|
||||
|
||||
# Automatically hide and show the Dock
|
||||
defaults write com.apple.dock autohide -bool true
|
||||
|
||||
# Make Dock icons of hidden applications translucent
|
||||
defaults write com.apple.dock showhidden -bool true
|
||||
|
||||
# Don't show recent applications in Dock
|
||||
defaults write com.apple.dock show-recents -bool false
|
||||
|
||||
# =============================================================================
|
||||
# Safari & WebKit
|
||||
# =============================================================================
|
||||
|
||||
# Privacy: don't send search queries to Apple
|
||||
defaults write com.apple.Safari UniversalSearchEnabled -bool false
|
||||
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
|
||||
|
||||
# Show the full URL in the address bar
|
||||
defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true
|
||||
|
||||
# Set Safari's home page to about:blank
|
||||
defaults write com.apple.Safari HomePage -string "about:blank"
|
||||
|
||||
# Prevent Safari from opening safe files automatically
|
||||
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
|
||||
|
||||
# Enable Safari's debug menu
|
||||
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true
|
||||
|
||||
# Enable the Develop menu and Web Inspector
|
||||
defaults write com.apple.Safari IncludeDevelopMenu -bool true
|
||||
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
|
||||
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
|
||||
|
||||
# Warn about fraudulent websites
|
||||
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
|
||||
|
||||
# Block pop-up windows
|
||||
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
|
||||
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
|
||||
|
||||
# Enable "Do Not Track"
|
||||
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
|
||||
|
||||
# =============================================================================
|
||||
# Mail
|
||||
# =============================================================================
|
||||
|
||||
# Copy email addresses as "foo@example.com" instead of "Foo Bar <foo@example.com>"
|
||||
defaults write com.apple.mail AddressesIncludeNameOnPasteboard -bool false
|
||||
|
||||
# =============================================================================
|
||||
# Terminal & iTerm 2
|
||||
# =============================================================================
|
||||
|
||||
# Only use UTF-8 in Terminal.app
|
||||
defaults write com.apple.terminal StringEncodings -array 4
|
||||
|
||||
# Enable Secure Keyboard Entry in Terminal.app
|
||||
defaults write com.apple.terminal SecureKeyboardEntry -bool true
|
||||
|
||||
# =============================================================================
|
||||
# Time Machine
|
||||
# =============================================================================
|
||||
|
||||
# Prevent Time Machine from prompting to use new hard drives as backup volume
|
||||
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
|
||||
|
||||
# =============================================================================
|
||||
# Activity Monitor
|
||||
# =============================================================================
|
||||
|
||||
# Show the main window when launching Activity Monitor
|
||||
defaults write com.apple.ActivityMonitor OpenMainWindow -bool true
|
||||
|
||||
# Visualize CPU usage in the Dock icon
|
||||
defaults write com.apple.ActivityMonitor IconType -int 5
|
||||
|
||||
# Show all processes in Activity Monitor
|
||||
defaults write com.apple.ActivityMonitor ShowCategory -int 0
|
||||
|
||||
# Sort Activity Monitor results by CPU usage
|
||||
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
|
||||
defaults write com.apple.ActivityMonitor SortDirection -int 0
|
||||
|
||||
# =============================================================================
|
||||
# TextEdit
|
||||
# =============================================================================
|
||||
|
||||
# Use plain text mode for new documents
|
||||
defaults write com.apple.TextEdit RichText -int 0
|
||||
|
||||
# Open and save files as UTF-8
|
||||
defaults write com.apple.TextEdit PlainTextEncoding -int 4
|
||||
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
|
||||
|
||||
# =============================================================================
|
||||
# Messages
|
||||
# =============================================================================
|
||||
|
||||
# Disable smart quotes in Messages.app
|
||||
defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "automaticQuoteSubstitutionEnabled" -bool false
|
||||
|
||||
# =============================================================================
|
||||
# Kill affected applications
|
||||
# =============================================================================
|
||||
|
||||
echo "Done! Restarting affected applications..."
|
||||
|
||||
for app in "Activity Monitor" \
|
||||
"cfprefsd" \
|
||||
"Dock" \
|
||||
"Finder" \
|
||||
"Mail" \
|
||||
"Messages" \
|
||||
"Safari" \
|
||||
"SystemUIServer" \
|
||||
"Terminal"; do
|
||||
killall "${app}" &> /dev/null || true
|
||||
done
|
||||
|
||||
echo "macOS defaults set successfully! 🎉"
|
||||
echo "Note: Some changes require a logout/restart to take effect."
|
||||
Executable
+100
@@ -0,0 +1,100 @@
|
||||
#!/usr/bin/env bash
|
||||
# macOS Keyboard Shortcuts Configuration
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "Setting up custom keyboard shortcuts..."
|
||||
|
||||
# =============================================================================
|
||||
# Global Shortcuts
|
||||
# =============================================================================
|
||||
|
||||
# Enable access for assistive devices (needed for some shortcuts)
|
||||
# Note: This may require manual approval in System Preferences > Security & Privacy
|
||||
|
||||
# Mission Control shortcuts
|
||||
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 32 "
|
||||
<dict>
|
||||
<key>enabled</key><true/>
|
||||
<key>value</key><dict>
|
||||
<key>type</key><string>standard</string>
|
||||
<key>parameters</key>
|
||||
<array>
|
||||
<integer>65535</integer>
|
||||
<integer>126</integer>
|
||||
<integer>8388608</integer>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
"
|
||||
|
||||
# =============================================================================
|
||||
# App-specific shortcuts (examples)
|
||||
# =============================================================================
|
||||
|
||||
# Finder shortcuts
|
||||
defaults write com.apple.finder NSUserKeyEquivalents -dict-add "Show Package Contents" "@\$o"
|
||||
|
||||
# =============================================================================
|
||||
# Service shortcuts
|
||||
# =============================================================================
|
||||
|
||||
# Create custom services directory
|
||||
mkdir -p ~/Library/Services
|
||||
|
||||
# Note: Some shortcuts need to be set manually in System Preferences
|
||||
cat << 'EOF' > ~/dotfiles/macos/KEYBOARD_SHORTCUTS.md
|
||||
# Keyboard Shortcuts Setup
|
||||
|
||||
## Manual Configuration Required
|
||||
|
||||
Some shortcuts must be set manually in System Preferences:
|
||||
|
||||
### System Preferences > Keyboard > Shortcuts
|
||||
|
||||
1. **Mission Control**
|
||||
- Mission Control: Control + Up Arrow
|
||||
- Application Windows: Control + Down Arrow
|
||||
- Desktop Left: Control + Left Arrow
|
||||
- Desktop Right: Control + Right Arrow
|
||||
|
||||
2. **Launchpad & Dock**
|
||||
- Launchpad: F4 (or customize)
|
||||
|
||||
3. **App Shortcuts**
|
||||
- All Applications:
|
||||
- "Zoom": Cmd+Shift+Z (if you use this often)
|
||||
|
||||
### Finder Shortcuts
|
||||
- Show Package Contents: Cmd+Shift+O (already set by script)
|
||||
|
||||
### Custom Services
|
||||
Create workflows in Automator for:
|
||||
- Open Terminal Here
|
||||
- Copy Path
|
||||
- Convert Images
|
||||
|
||||
## Third-party App Shortcuts
|
||||
|
||||
Configure these in the respective apps:
|
||||
|
||||
### Karabiner-Elements
|
||||
Your existing config handles:
|
||||
- Cmd/Option swap for external keyboards
|
||||
|
||||
### LaunchBar
|
||||
- Activation: Space+Space (or Cmd+Space)
|
||||
|
||||
### Bartender
|
||||
- Configure menu bar item shortcuts as needed
|
||||
|
||||
## Verification
|
||||
|
||||
Test shortcuts after setup:
|
||||
1. Mission Control (Control + Up)
|
||||
2. Desktop switching (Control + Left/Right)
|
||||
3. Finder package contents (Cmd+Shift+O)
|
||||
EOF
|
||||
|
||||
echo "Keyboard shortcuts configuration complete!"
|
||||
echo "See ~/dotfiles/macos/KEYBOARD_SHORTCUTS.md for manual setup steps."
|
||||
Executable
+152
@@ -0,0 +1,152 @@
|
||||
#!/usr/bin/env bash
|
||||
# macOS Security Settings
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
echo "Configuring macOS security settings..."
|
||||
|
||||
# Ask for admin password upfront
|
||||
sudo -v
|
||||
|
||||
# =============================================================================
|
||||
# Screen Security
|
||||
# =============================================================================
|
||||
|
||||
# Require password immediately after sleep or screen saver begins
|
||||
defaults write com.apple.screensaver askForPassword -int 1
|
||||
defaults write com.apple.screensaver askForPasswordDelay -int 0
|
||||
|
||||
# Set screen saver to start after 10 minutes of inactivity
|
||||
defaults -currentHost write com.apple.screensaver idleTime -int 600
|
||||
|
||||
# =============================================================================
|
||||
# Firewall
|
||||
# =============================================================================
|
||||
|
||||
# Enable firewall
|
||||
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
|
||||
|
||||
# Enable firewall stealth mode (don't respond to ICMP ping requests or closed TCP/UDP ports)
|
||||
sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -int 1
|
||||
|
||||
# Enable firewall logging
|
||||
sudo defaults write /Library/Preferences/com.apple.alf loggingenabled -int 1
|
||||
|
||||
# =============================================================================
|
||||
# Privacy & Tracking
|
||||
# =============================================================================
|
||||
|
||||
# Disable location services for system services
|
||||
sudo defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -bool false
|
||||
|
||||
# Disable analytics & improvements
|
||||
defaults write com.apple.SubmitDiagInfo AutoSubmit -bool false
|
||||
defaults write com.apple.applicationaccess.plist com.apple.applicationaccess.feedback -bool false
|
||||
|
||||
# Disable personalized ads
|
||||
defaults write com.apple.AdLib forceLimitAdTracking -bool true
|
||||
|
||||
# =============================================================================
|
||||
# Safari Security (if Safari is used)
|
||||
# =============================================================================
|
||||
|
||||
# Enable "Do Not Track"
|
||||
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true
|
||||
|
||||
# Block pop-up windows
|
||||
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
|
||||
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
|
||||
|
||||
# Disable auto-filling passwords (if you use 1Password)
|
||||
defaults write com.apple.Safari AutoFillPasswords -bool false
|
||||
|
||||
# Warn about fraudulent websites
|
||||
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
|
||||
|
||||
# Disable automatic opening of safe files
|
||||
defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
|
||||
|
||||
# =============================================================================
|
||||
# System Security
|
||||
# =============================================================================
|
||||
|
||||
# Disable guest account
|
||||
sudo dscl . create /Users/Guest UserShell /usr/bin/false
|
||||
|
||||
# Disable remote apple events
|
||||
sudo systemsetup -setremoteappleevents off
|
||||
|
||||
# Disable remote login (SSH) - uncomment if you don't need it
|
||||
# sudo systemsetup -setremotelogin off
|
||||
|
||||
# Disable wake-on modem
|
||||
sudo systemsetup -setwakeonmodem off
|
||||
|
||||
# Disable wake-on network access
|
||||
sudo systemsetup -setwakeonnetworkaccess off
|
||||
|
||||
# Disable file sharing
|
||||
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist 2>/dev/null || true
|
||||
|
||||
# =============================================================================
|
||||
# FileVault (Disk Encryption)
|
||||
# =============================================================================
|
||||
|
||||
# Check if FileVault is enabled
|
||||
if ! sudo fdesetup status | grep -q "FileVault is On"; then
|
||||
echo "WARNING: FileVault is not enabled!"
|
||||
echo "Consider enabling FileVault for full disk encryption:"
|
||||
echo "System Preferences > Security & Privacy > FileVault"
|
||||
fi
|
||||
|
||||
# =============================================================================
|
||||
# Gatekeeper
|
||||
# =============================================================================
|
||||
|
||||
# Enable Gatekeeper
|
||||
sudo spctl --master-enable
|
||||
|
||||
# =============================================================================
|
||||
# Secure Empty Trash
|
||||
# =============================================================================
|
||||
|
||||
# Enable secure empty trash (if available on your macOS version)
|
||||
defaults write com.apple.finder EmptyTrashSecurely -bool true 2>/dev/null || true
|
||||
|
||||
# =============================================================================
|
||||
# Network Security
|
||||
# =============================================================================
|
||||
|
||||
# Disable Bonjour multicast advertisements
|
||||
sudo defaults write /Library/Preferences/com.apple.mDNSResponder.plist NoMulticastAdvertisements -bool true
|
||||
|
||||
# =============================================================================
|
||||
# Application Security
|
||||
# =============================================================================
|
||||
|
||||
# Prevent automatic software updates
|
||||
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticDownload -bool false
|
||||
# Note: You might want to keep this enabled and just review updates manually
|
||||
|
||||
# Show all file extensions to prevent malware masquerading
|
||||
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
|
||||
|
||||
# =============================================================================
|
||||
# Privacy - Microphone and Camera
|
||||
# =============================================================================
|
||||
|
||||
echo ""
|
||||
echo "Security configuration complete!"
|
||||
echo ""
|
||||
echo "Manual steps required:"
|
||||
echo "1. System Preferences > Security & Privacy > FileVault - Enable if not already on"
|
||||
echo "2. System Preferences > Security & Privacy > Privacy - Review app permissions"
|
||||
echo "3. System Preferences > Screen Time - Configure if desired"
|
||||
echo "4. Consider enabling 2FA for Apple ID"
|
||||
echo "5. Review Location Services in System Preferences"
|
||||
echo ""
|
||||
echo "Third-party security tools to consider:"
|
||||
echo "- LuLu (firewall) - already in your Brewfile"
|
||||
echo "- OverSight (camera/mic monitor) - already in your Brewfile"
|
||||
echo "- Little Snitch (network monitor)"
|
||||
echo "- 1Password (password manager) - already in your Brewfile"
|
||||
Executable
+85
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bash
|
||||
# Master macOS setup script
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
MACOS_DIR="$HOME/dotfiles/macos"
|
||||
|
||||
# Colors
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
echo -e "${BLUE}macOS System Setup${NC}"
|
||||
echo "=================="
|
||||
echo ""
|
||||
|
||||
# Function to ask yes/no
|
||||
ask() {
|
||||
while true; do
|
||||
read -p "$1 (y/n) " -n 1 -r
|
||||
echo
|
||||
if [[ $REPLY =~ ^[Yy]$ ]]; then
|
||||
return 0
|
||||
elif [[ $REPLY =~ ^[Nn]$ ]]; then
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# Backup current settings
|
||||
if ask "Backup current macOS settings first?"; then
|
||||
echo -e "${YELLOW}Creating backup...${NC}"
|
||||
bash "$MACOS_DIR/backup-defaults.sh"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Apply system defaults
|
||||
echo -e "${YELLOW}Choose how to apply system defaults:${NC}"
|
||||
echo "1) Interactive mode (recommended for first time)"
|
||||
echo "2) Apply all defaults automatically"
|
||||
echo "3) Skip defaults"
|
||||
read -p "Choice (1-3): " -n 1 -r
|
||||
echo ""
|
||||
|
||||
case $REPLY in
|
||||
1)
|
||||
bash "$MACOS_DIR/defaults-interactive.sh"
|
||||
;;
|
||||
2)
|
||||
bash "$MACOS_DIR/defaults.sh"
|
||||
;;
|
||||
*)
|
||||
echo "Skipping defaults..."
|
||||
;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
|
||||
# Security settings
|
||||
if ask "Apply security settings?"; then
|
||||
echo -e "${YELLOW}Applying security settings...${NC}"
|
||||
bash "$MACOS_DIR/security.sh"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Keyboard shortcuts
|
||||
if ask "Set up keyboard shortcuts?"; then
|
||||
echo -e "${YELLOW}Setting up keyboard shortcuts...${NC}"
|
||||
bash "$MACOS_DIR/keyboard-shortcuts.sh"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}macOS setup complete!${NC}"
|
||||
echo ""
|
||||
echo "Summary of what was configured:"
|
||||
echo "- System defaults (UI, Finder, Dock, etc.)"
|
||||
echo "- Security settings (firewall, privacy, etc.)"
|
||||
echo "- Keyboard shortcuts"
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo "1. Log out and back in for all changes to take effect"
|
||||
echo "2. Review security settings in System Preferences"
|
||||
echo "3. Configure any remaining manual settings"
|
||||
echo "4. Install applications: brew bundle install"
|
||||
Reference in New Issue
Block a user