# 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)