-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo.sh
289 lines (223 loc) · 12.7 KB
/
go.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#!/bin/sh
###############################################################################
# Settings #
###############################################################################
source $PWD/goshsettings.txt
# goshsettings.txt must look like this:
# LOSTFOUNDTEXT="If found, please contact Jonathan Stanley: 1-800-REWARD, [email protected]"
# USERPICTURE="https://www.gravatar.com/avatar/aaaaaaaaaaaaaaaaaaa?s=500.jpg"
###############################################################################
# Notes #
###############################################################################
#how to find changes to settings:
#find . -mmin -1 -type f -exec ls -l {} +
# ** OR
# $defaults read > before
# $defaults read > after
# code --diff before after
###############################################################################
# Sudo #
###############################################################################
echo "Enter admin password if prompted"
sudo -v #-v adds 5 minutes https://www.sudo.ws/man/1.8.13/sudo.man.html
# Keep-alive: update existing `sudo` time stamp until finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
###############################################################################
# Homebrew #
###############################################################################
# Install homebrew if not already installed
which -s brew
if [[ $? != 0 ]] ; then
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
else
echo "Homebrew already installed"
fi
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/jonathanstanley/gosh/master/bundle.sh)"
#https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#https://dotfiles.github.io/
###############################################################################
# General UI/UX #
###############################################################################
# Close System Preferences panes to avoid overriding this script
osascript -e 'tell application "System Preferences" to quit'
#Show battery percent in system tray
defaults write com.apple.menuextra.battery ShowPercent true
# Enable lid wakeup
sudo pmset -a lidwake 1
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Disable the crash reporter
defaults write com.apple.CrashReporter DialogType -string "none"
# Disable Notification Center and remove the menu bar icon
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null
# Stop iTunes from responding to the keyboard media keys
launchctl unload -w /System/Library/LaunchAgents/com.apple.rcd.plist 2> /dev/null
# Disable automatic autocorrect (annoying when typing code)
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false
defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Disable recent items
defaults write -g NSNavRecentPlacesLimit -int 0
# Disable language / flag input menu in menu bar
defaults write com.apple.TextInputMenu visible -bool false
# Disable startup chime (revert with sudo nvram StartupMute=%00)
sudo nvram StartupMute=%01
# Hide extra icons in menu bar
#remove wifi icon (available in bento box)
defaults write com.apple.controlcenter "NSStatusItem Visible WiFi" -int 0
#remove spotlight search icon (use cmd+space)
defaults write com.apple.controlcenter "NSStatusItem Visible Item-0" -int 0;
###############################################################################
# Set a standard user picture from a URL #
###############################################################################
#Use the picture from this GitHub account
sudo curl -o "/Library/User Pictures/user_picture.png" $USERPICTURE
user_picture="/Library/User Pictures/user_picture.png"
if [ -f "$user_picture" ]
then
#remove existing user picture
sudo -u $USER dscl . delete /Users/$USER jpegphoto
sudo -u $USER dscl . delete /Users/$USER Picture
#set new user picture
sudo dscl . create /Users/$USER Picture "$user_picture"
else
echo "Failed to set:" $user_picture
fi
###############################################################################
# Trackpad, mouse, keyboard, Bluetooth accessories, and input #
###############################################################################
# Trackpad: enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults write com.apple.AppleMultitouchTrackpad Clicking -int 1
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
###############################################################################
# Screen #
###############################################################################
# Save screenshots to the desktop
defaults write com.apple.screencapture location -string "${HOME}/Desktop"
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
defaults write com.apple.screencapture type -string "png"
# Disable shadow in screenshots
defaults write com.apple.screencapture disable-shadow -bool true
###############################################################################
# Finder #
###############################################################################
# Set the default `PfDe` location for new Finder windows
# For other paths, use `PfLo` and `file:///full/path/here/`
defaults write com.apple.finder NewWindowTarget -string "PfLo"
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/"
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
# Finder: disable window animations and Get Info animations
defaults write com.apple.finder DisableAllAnimations -bool true
# Finder: show hidden files by default (easy enough to toggle with cmd+shift+.)
# defaults write com.apple.Finder AppleShowAllFiles -bool true
# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -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
# Show the ~/Library folder
#chflags nohidden ~/Library
# Finder: show status bar
defaults write com.apple.finder ShowStatusBar -bool true
# Finder: show path bar
defaults write com.apple.finder ShowPathbar -bool true
# Finder: remove color tags
defaults write com.apple.finder ShowRecentTags -bool false
# Avoid creating .DS_Store files on network or USB volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Use column view in all Finder windows by default
# Four-letter codes for the view modes: `icnv` = icon, `clmv` = column, `Flwv` = coverflow, `Nlsv` = list
defaults write com.apple.finder FXPreferredViewStyle -string "clmv"
# Show items in finder sidebar
defaults write com.apple.sidebarlists systemitems -dict-add ShowEjectables -bool true
defaults write com.apple.sidebarlists systemitems -dict-add ShowHardDisks -bool false
defaults write com.apple.sidebarlists systemitems -dict-add ShowRemovable -bool false
defaults write com.apple.sidebarlists systemitems -dict-add ShowServers -bool true
# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Expand the “General”, “Open with”, and “Sharing & Permissions” File Info panes
defaults write com.apple.finder FXInfoPanesExpanded -dict \
General -bool true \
OpenWith -bool true \
Privileges -bool true
# Show the /Volumes folder
sudo chflags nohidden /Volumes
# Set sidebar favorites
#https://github.com/mosen/mysides
# //not working on Apple silicon
# mysides add $USER file:///Users/$USER/
# mysides remove myDocuments.cannedSearch
# mysides remove Applications
# mysides remove Desktop
# mysides remove Documents
###############################################################################
# Dock, Dashboard, and hot corners #
###############################################################################
# Minimize windows into their application’s icon
#defaults write com.apple.dock minimize-to-application -bool true
# Set the icon size of Dock items to 36 pixels
defaults write com.apple.dock tilesize -int 36
# Wipe all (default) app icons from the Dock
# This is only really useful when setting up a new Mac, or if you don’t use the Dock to launch apps.
defaults write com.apple.dock persistent-apps -array
# Disable Dashboard
defaults write com.apple.dashboard mcx-disabled -bool true
# Don’t show Dashboard as a Space
defaults write com.apple.dock dashboard-in-overlay -bool true
# Don’t automatically rearrange Spaces based on most recent use
defaults write com.apple.dock mru-spaces -bool false
# Remove the auto-hiding Dock delay
defaults write com.apple.dock autohide-delay -float 0
# Automatically hide and show the Dock
defaults write com.apple.dock autohide -bool true
# Don't show recent applications in the Dock
defaults write com.apple.dock show-recents -bool false
# Disable the Launchpad gesture (pinch with thumb and three fingers)
defaults write com.apple.dock showLaunchpadGestureEnabled -int 0
# Reset Launchpad, but keep the desktop wallpaper intact
find "${HOME}/Library/Application Support/Dock" -name "*-*.db" -maxdepth 1 -delete
###############################################################################
# Time Machine #
###############################################################################
# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# Disable local Time Machine backups
sudo tmutil disablelocal
sudo tmutil disable #big sur
###############################################################################
# Photos #
###############################################################################
# Prevent Photos from opening automatically when devices are plugged in
defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true
###############################################################################
# Google Chrome #
###############################################################################
# Use the system-native print preview dialog
#defaults write com.google.Chrome DisablePrintPreview -bool true
# Expand the print dialog by default
defaults write com.google.Chrome PMPrintingExpandedStateForPrint2 -bool true
# Disable dark mode (indistinguishable from incognito)
# defaults write com.google.Chrome NSRequiresAquaSystemAppearance -bool YES
###############################################################################
# Security #
###############################################################################
# Disable the “are you sure you want to open this application?” dialog
defaults write com.apple.LaunchServices LSQuarantine -bool false
#Set security for HIPAA compliance
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/hipaacert/macos-hipaa/master/comply.sh)"
# Add lost/found notice on Login Window
sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "${LOSTFOUNDTEXT}"