-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbootstrap.sh
executable file
·172 lines (153 loc) · 6.44 KB
/
bootstrap.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
#!/bin/zsh
# zsh should be available on OSX >= 10.12. change to bash and symlink
# zprezto manually if this is not the case
# see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
# or https://github.com/atomantic/dotfiles/blob/master/install.sh
# for more tweaks
ABSPATH=$(cd "$(dirname "$0")"; pwd)
# get a sudo token
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.macos` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
# disable guest login
sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool false
# Finder
# Show battery percentage in menu bar
defaults -currentHost write com.apple.controlcenter.plist BatteryShowPercentage -bool true
# Show output sound settings in menu bar
defaults -currentHost write com.apple.controlcenter.plist Sound -int 18
# Set theme to dark
defaults write NSGlobalDomain AppleInterfaceStyle -string "Dark"
# Open home directory by default
defaults write com.apple.finder NewWindowTarget -string "PfHm"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# List view as default
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# Show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Allow text selection in Quick Look
defaults write com.apple.finder QLEnableTextSelection -bool true
# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -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
# disable .DS_Store on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# dock size
defaults write com.apple.dock tilesize -int 36
killall Dock
# Spotlight
# Disable Spotlight indexing for any volume that gets mounted and has not yet been indexed
# Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
# sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
# Change indexing order and disable some file types from being indexed
defaults write com.apple.spotlight orderedItems -array \
'{"enabled" = 1;"name" = "APPLICATIONS";}' \
'{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
'{"enabled" = 1;"name" = "DIRECTORIES";}' \
'{"enabled" = 1;"name" = "PDF";}' \
'{"enabled" = 1;"name" = "FONTS";}' \
'{"enabled" = 0;"name" = "DOCUMENTS";}' \
'{"enabled" = 0;"name" = "MESSAGES";}' \
'{"enabled" = 0;"name" = "CONTACT";}' \
'{"enabled" = 0;"name" = "EVENT_TODO";}' \
'{"enabled" = 0;"name" = "IMAGES";}' \
'{"enabled" = 0;"name" = "BOOKMARKS";}' \
'{"enabled" = 0;"name" = "MUSIC";}' \
'{"enabled" = 0;"name" = "MOVIES";}' \
'{"enabled" = 0;"name" = "PRESENTATIONS";}' \
'{"enabled" = 0;"name" = "SPREADSHEETS";}' \
'{"enabled" = 0;"name" = "SOURCE";}'
# Load new settings before rebuilding the index
killall mds > /dev/null 2>&1
# Make sure indexing is enabled for the main volume
sudo mdutil -i on / > /dev/null
# useless man page shortcut
VALUE='<dict><key>enabled_context_menu</key><false/><key>enabled_services_menu</key><false/><key>presentation_modes</key><dict><key>ContextMenu</key><false/><key>ServicesMenu</key><false/></dict></dict>'
defaults write pbs NSServicesStatus \
-dict-add \
'com.apple.Terminal - Open man Page in Terminal - openManPage' \
"$VALUE"
defaults write pbs NSServicesStatus \
-dict-add \
'com.apple.Terminal - Search man Page Index in Terminal - searchManPages' \
"$VALUE"
# misc
# verbose boot
sudo nvram boot-args="-v"
# disable screenshot shadows
defaults write com.apple.screencapture disable-shadow -bool true
# HiDPI modes
# sudo defaults write /Library/Preferences/com.apple.windowserver DisplayResolutionEnabled -bool true
# typing sanity
# Disable automatic capitalization as it’s annoying when typing code
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
# Disable smart dashes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Disable automatic period substitution as it’s annoying when typing code
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
# Disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# Disable auto-correct
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# key repeat
defaults write NSGlobalDomain KeyRepeat -int 2
defaults write NSGlobalDomain InitialKeyRepeat -int 15
# disable accent on key hold
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false
# security
# require password immediately
defaults write com.apple.screensaver askForPassword -bool true
defaults write com.apple.screensaver askForPasswordDelay -int 0
# brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/opt/homebrew/bin/brew shellenv)"
brew analytics off
# apps
brew install zsh
brew install git
# brew install python3
# brew install openssh
# brew install rbenv
# setup zsh
git clone --recursive https://github.com/sorin-ionescu/prezto.git "${ZDOTDIR:-$HOME}/.zprezto"
setopt EXTENDED_GLOB
setopt EXTENDED_GLOB
for rcfile in "${ZDOTDIR:-$HOME}"/.zprezto/runcoms/^README.md(.N); do
ln -s "$rcfile" "${ZDOTDIR:-$HOME}/.${rcfile:t}"
done
# remove stock configs
rm ~/.zshrc ~/.zpreztorc
# symlink
ln -s $ABSPATH/.zprestorc /Users/$USER/.zpreztorc
ln -s $ABSPATH/.zshrc /Users/$USER/.zshrc
ln -s $ABSPATH/.p10k.zsh /Users/$USER/.p10k.zsh
# set shell to new zsh
sudo dscl . -create /Users/$USER UserShell /opt/homebrew/bin/zsh
# set global gitignore
git config --global core.excludesfile $ABSPATH/gitignore_global
# patch fonts (prefer a precompiled font; repo is ~1 GiB)
# SFMono: /System/Applications/Utilities/Terminal.app/Contents/Resources/Fonts
# git clone --depth 1 https://github.com/ryanoasis/nerd-fonts.git
# manual
# set hostname via System Preferences → Sharing
# install uBlock Origin on browsers
# enable night shift
# can brew cask install these
# iterm
# dropbox
# keepassxc
# chrome
# vlc
# spectacle
# spotify
# slack
# vscode
# tunnelblick
# rdesktop