2027 年開發者 macOS 設定指南:新 Mac 可直接複製執行的命令
Best macOS Settings for Developers in 2027 (Copy-Paste Commands for a New Mac)
這份開發者指南整理了新 Mac 的 macOS 設定,並提供可貼入設定腳本的命令。命令涵蓋鍵盤重複、Finder 顯示隱藏檔案與副檔名、Dock、截圖儲存位置,以及透過 sudo_local 為 sudo 啟用 Touch ID。文章亦建議把項目資料夾或大型 node_modules 加入 Spotlight 搜尋私隱清單,避免大量依賴檔案索引消耗電池並拖慢搜尋。
A new Mac ships with settings tuned for everyone. These are the macOS settings developers should change in 2027, most of them one command, so you can paste them into a setup script.
Keyboard
# faster key repeat (log out to apply)
defaults write -g KeyRepeat -int 2
defaults write -g InitialKeyRepeat -int 15
# hold a key to repeat it instead of showing accents
defaults write -g ApplePressAndHoldEnabled -bool false
Also: System Settings, Keyboard, Keyboard Shortcuts, and turn off the Spotlight shortcut if you use a launcher such as Raycast.
Finder
defaults write com.apple.finder AppleShowAllFiles -bool true # hidden files
defaults write NSGlobalDomain AppleShowAllExtensions -bool true # file extensions
defaults write com.apple.finder ShowPathbar -bool true # path bar
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true # no .DS_Store on network drives
killall Finder
Dock
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
killall Dock
Screenshots
mkdir -p ~/Screenshots
defaults write com.apple.screencapture location ~/Screenshots
defaults write com.apple.screencapture type png
killall SystemUIServer
Touch ID for sudo
sed "s/^#auth/auth/" /etc/pam.d/sudo_local.template | sudo tee /etc/pam.d/sudo_local
This uses the sudo_local file macOS added in Sonoma, so it survives system updates.
Spotlight and indexing
Add your projects folder, or at least big node_modules trees, to System Settings, Spotlight, Search Privacy. Indexing millions of dependency files wastes battery and slows searches.
Name the machine
sudo scutil --set ComputerName "dev-mbp"
sudo scutil --set HostName "dev-mbp"
sudo scutil --set LocalHostName "dev-mbp"
Windows, disk and the notch
Three things settings alone cannot fix, each with its own guide:
- Windows piling up: Best window managers for macOS in 2027
- A disk full of node_modules and Docker: Best ways to free up disk space on a developer Mac
- Missing Claude Code prompts behind other windows: Best Mac notch apps for developers
Put it in a script
Save the blocks above as macos-setup.sh in your dotfiles and you will never configure a Mac by hand again.
What setting do you change first on a new Mac? Tell me in the comments.
來源:DEV Community · dev.to