-
Notifications
You must be signed in to change notification settings - Fork 0
/
osxsetup.sh
executable file
·142 lines (104 loc) · 4.98 KB
/
osxsetup.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
#!/usr/bin/env sh
###
# Terminal
# Enable Secure Keyboard Entry in Terminal.app
# See: https://security.stackexchange.com/a/47786/8918
defaults write com.apple.terminal SecureKeyboardEntry -bool true
# Set system hostname
if [ ! -f ~/.hostname ] ; then
echo "Enter hostname: "
read -r hostname
scutil --set HostName "$hostname"
scutil --set ComputerName "$hostname"
scutil --set LocalHostName "$hostname"
echo "$hostname" > ~/.hostname
fi
# Set terminal defaults
# Set theme
defaults write com.apple.terminal "Startup Window Settings" -string "Homebrew"
defaults write com.apple.terminal "Default Window Settings" -string "Homebrew"
# Disable audio bell
/usr/libexec/PlistBuddy -c "Delete 'Window Settings':Homebrew:AudibleBell" ~/Library/Preferences/com.apple.Terminal.plist > /dev/null 2>&1
/usr/libexec/PlistBuddy -c "Add 'Window Settings':Homebrew:AudibleBell bool false" ~/Library/Preferences/com.apple.Terminal.plist
###
# UI/UX
# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0
# Open and save files as UTF-8 in TextEdit
defaults write com.apple.TextEdit PlainTextEncoding -int 4
defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4
# Disable autocorrect
defaults write -g NSAutomaticSpellingCorrectionEnabled -bool false
# Disable smart quotes and dashes
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false
# Also for textedit
defaults write com.apple.TextEdit SmartQuotes -bool false
defaults write com.apple.TextEdit SmartDashes -bool false
# Disable automatic keyboard backlight
defaults write com.apple.BezelServices kDim -bool false
# Turn off backlight after interval of inactivity
defaults write com.apple.BezelServices kDimTime -int 1
# Write screenshots to Documents folder, making it easier to drag into browser
defaults write com.apple.screencapture location ~/Documents
# Restart UIServer to use updated location
# Show battery percentage
defaults write com.apple.menuextra.battery ShowPercent -bool true
# Disable smart quotes as they’re annoying when typing code
defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
# Hide icons for hard drives, servers, and removable media from the desktop
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowMountedServersOnDesktop -bool false
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool false
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool false
# Show all files in finder
defaults write com.apple.finder AppleShowAllFiles YES
# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# 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
###
# Screen and Screensaver
# Require password 5 seconds after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 5
defaults -currentHost write com.apple.screensaver moduleDict -dict path -string "/System/Library/Frameworks/ScreenSaver.framework/PlugIns/iLifeSlideshows.appex" moduleName -string "iLifeSlideshows" type -int 0
###
# Safari
# Privacy: don’t send search queries to Apple
defaults write com.apple.Safari UniversalSearchEnabled -bool false
defaults write com.apple.Safari SuppressSearchSuggestions -bool true
# Warn about fraudulent websites
defaults write com.apple.Safari WarnAboutFraudulentWebsites -bool true
# Disable Java
defaults write com.apple.Safari WebKitJavaEnabled -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaEnabled -bool false
# Block pop-up windows
defaults write com.apple.Safari WebKitJavaScriptCanOpenWindowsAutomatically -bool false
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2JavaScriptCanOpenWindowsAutomatically -bool false
# DISABLE “Do Not Track”. Using it makes you more unique
defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool false
###
# Security
# Disable guest account selection
sudo defaults write /Library/Preferences/com.apple.loginwindow GuestEnabled -bool FALSE
# Disable IR Controller
echo "Prompt to disable IR Controller"
sudo defaults write /Library/Preferences/com.apple.driver.AppleIRController DeviceEnabled -bool false
# Turn on firewall
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
# Turn on stealth
sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -int 1
###
# Other
# Install command line devtools
xcode-select -p 1>/dev/null
if [ $? -ne 0 ] ; then
xcode-select --install
fi
#Enable locate command
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
# Restart services for effects
killall Finder
killall SystemUIServer