Files
os-init/macos/macos-init.sh
T
guofangandClaude Sonnet 5.5 08a748feef Initial commit
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 22:52:34 +08:00

65 lines
2.6 KiB
Bash
Executable File

#!/usr/bin/env bash
set -Eeuo pipefail
# Runtime environment
if [[ "$(uname -s)" != "Darwin" ]]; then
echo "Error: this script supports macOS only." >&2
exit 1
fi
if (( $(sw_vers -productVersion | cut -d. -f1) < 13 )); then
echo "Error: this script requires macOS 13 or later." >&2
exit 1
fi
# Show all file extensions in Finder
# defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Show the path bar and status bar in Finder
# defaults write com.apple.finder ShowPathbar -bool true
# defaults write com.apple.finder ShowStatusBar -bool true
# Search the current folder by default, and use the list view
# defaults write com.apple.finder FXDefaultSearchScope -string SCcf
# defaults write com.apple.finder FXPreferredViewStyle -string Nlsv
# Do not warn when changing a file extension
# defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Keep .DS_Store files off network shares and USB drives
# defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Do not show recent applications in the Dock
# defaults write com.apple.dock show-recents -bool false
# Keep Spaces in a fixed order
# defaults write com.apple.dock mru-spaces -bool false
# Repeat keys instead of showing the accent popup, and repeat faster
# defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# defaults write NSGlobalDomain KeyRepeat -int 2
# defaults write NSGlobalDomain InitialKeyRepeat -int 25
# Tap to click
# defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
# defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Expand the save and print dialogs by default
# defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
# defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# Save screenshots as PNG without window shadows to ~/Screenshots
# mkdir -p "${HOME}/Screenshots"
# defaults write com.apple.screencapture location -string "${HOME}/Screenshots"
# defaults write com.apple.screencapture type -string png
# defaults write com.apple.screencapture disable-shadow -bool true
# Restart the affected apps so the settings above take effect
# killall Finder Dock SystemUIServer >/dev/null 2>&1 || true
# echo "macOS configuration completed. Log out and back in if tap to click or key repeat does not take effect."