Skip to content

Commit 72ed4e9

Browse files
committed
feat(macos): apply opinionated defaults via mise task
Add `macos:defaults` mise task and `make macos` target to configure Finder, keyboard repeat, and disable text auto-substitution that breaks code. Wired into `dotfiles:install` so fresh setups apply it automatically.
1 parent 1c5bb14 commit 72ed4e9

4 files changed

Lines changed: 62 additions & 0 deletions

File tree

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,9 @@ clean: ## dotfiles のシンボリックリンクを削除する
4848
.PHONY: upgrade
4949
upgrade: ## 管理対象ツールを更新する
5050
@$(MISE_TASK) dotfiles:upgrade
51+
52+
## macOS ##
53+
54+
.PHONY: macos
55+
macos: ## macOS の defaults を適用する
56+
@$(MISE_TASK) macos:defaults

mise/tasks/dotfiles/install

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@ mise install
1717
mise run zsh:refresh-completion
1818
mise run nvim:treesitter
1919
mise run fonts:install
20+
mise run macos:defaults
2021

2122
prek install --overwrite --install-hooks

mise/tasks/macos/defaults

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/usr/bin/env bash
2+
#MISE description="macOS の defaults を適用する"
3+
set -euo pipefail
4+
5+
TASK_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd -P)"
6+
readonly TASK_DIR
7+
REPO_ROOT="$(git -C "${TASK_DIR}" rev-parse --show-toplevel)"
8+
readonly REPO_ROOT
9+
cd "${REPO_ROOT}"
10+
11+
./scripts/apply-macos-defaults.sh

scripts/apply-macos-defaults.sh

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
5+
readonly SCRIPT_DIR
6+
# shellcheck source=scripts/common.sh
7+
source "${SCRIPT_DIR}/common.sh"
8+
9+
if ! is_macos; then
10+
skip "macOS 以外のため defaults の適用をスキップします"
11+
exit 0
12+
fi
13+
14+
info "macOS の defaults を適用します"
15+
16+
# Finder
17+
defaults write com.apple.finder AppleShowAllFiles -bool true
18+
defaults write com.apple.finder ShowPathbar -bool true
19+
defaults write com.apple.finder ShowStatusBar -bool true
20+
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
21+
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
22+
defaults write com.apple.finder _FXShowPosixPathInWindowTitle -bool true
23+
defaults write com.apple.finder _FXSortFoldersFirst -bool true
24+
25+
# Global
26+
defaults write -g AppleShowAllExtensions -bool true
27+
28+
# Keyboard repeat
29+
defaults write -g InitialKeyRepeat -int 10
30+
defaults write -g KeyRepeat -int 2
31+
32+
# 長押しでアクセント記号メニューを出さず、キーリピートを有効化
33+
defaults write -g ApplePressAndHoldEnabled -bool false
34+
35+
# テキスト自動置換(コードを壊す系)を無効化
36+
defaults write -g NSAutomaticQuoteSubstitutionEnabled -bool false
37+
defaults write -g NSAutomaticDashSubstitutionEnabled -bool false
38+
defaults write -g NSAutomaticPeriodSubstitutionEnabled -bool false
39+
defaults write -g NSAutomaticCapitalizationEnabled -bool false
40+
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
41+
42+
killall Finder >/dev/null 2>&1 || true
43+
44+
success "macOS の defaults を適用しました(キーリピート系はログアウト後に反映)"

0 commit comments

Comments
 (0)