-
Notifications
You must be signed in to change notification settings - Fork 1
/
.osx
executable file
·131 lines (94 loc) · 5.16 KB
/
.osx
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
#!/usr/bin/env bash
# ~/.osx — Subset of http://mths.be/osx
# Variables
green='\033[1;32m'
nocolor='\033[0m'
yellow='\033[1;33m'
function log() {
echo -e "\n${green}${@}${nocolor}"
}
function warning() {
echo -e "\n⇏ ${yellow}${@}${nocolor}"
}
log "Refreshing Sudo"
sudo -v
# Keep-alive: update existing `sudo` time stamp until `.osx` has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
log "Setting Printer Defaults ..."
# Automatically quit printer app once the print jobs complete
/usr/bin/defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
log "Setting Screen Defaults ..."
# Save screenshots to the desktop
/usr/bin/defaults write com.apple.screencapture location -string "$HOME/Desktop"
# Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
/usr/bin/defaults write com.apple.screencapture type -string "png"
# Disable shadow in screenshots
/usr/bin/defaults write com.apple.screencapture disable-shadow -bool true
# Enable subpixel font rendering on non-Apple LCDs
/usr/bin/defaults write NSGlobalDomain AppleFontSmoothing -int 2
log "Setting Finder Defaults ..."
# Show icons for hard drives, servers, and removable media on the desktop
/usr/bin/defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
/usr/bin/defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true
/usr/bin/defaults write com.apple.finder ShowMountedServersOnDesktop -bool true
/usr/bin/defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true
# Finder: show status bar
/usr/bin/defaults write com.apple.finder ShowStatusBar -bool true
# Finder: show path bar
/usr/bin/defaults write com.apple.finder ShowPathbar -bool true
# Finder: allow text selection in Quick Look
/usr/bin/defaults write com.apple.finder QLEnableTextSelection -bool true
# Disable the warning when changing a file extension
/usr/bin/defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Avoid creating .DS_Store files on network volumes
/usr/bin/defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Automatically open a new Finder window when a volume is mounted
/usr/bin/defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
/usr/bin/defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
/usr/bin/defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
# Use list view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
/usr/bin/defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Disable the warning before emptying the Trash
/usr/bin/defaults write com.apple.finder WarnOnEmptyTrash -bool false
# Empty Trash securely by default
/usr/bin/defaults write com.apple.finder EmptyTrashSecurely -bool true
# Enable AirDrop over Ethernet and on unsupported Macs running Lion
/usr/bin/defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
# Show the ~/Library folder
chflags nohidden ~/Library
# Prevent Time Machine from prompting to use new hard drives as backup volume
/usr/bin/defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
log "Setting Safari Defaults ..."
# Set Safari’s home page to `about:blank` for faster loading
/usr/bin/defaults write com.apple.Safari HomePage -string "about:blank"
# Prevent Safari from opening ‘safe’ files automatically after downloading
/usr/bin/defaults write com.apple.Safari AutoOpenSafeDownloads -bool false
# Allow hitting the Backspace key to go to the previous page in history
/usr/bin/defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2BackspaceKeyNavigationEnabled -bool true
# Hide Safari’s bookmarks bar by default
/usr/bin/defaults write com.apple.Safari ShowFavoritesBar -bool false
# Disable Safari’s thumbnail cache for History and Top Sites
/usr/bin/defaults write com.apple.Safari DebugSnapshotsUpdatePolicy -int 2
# Make Safari’s search banners default to Contains instead of Starts With
/usr/bin/defaults write com.apple.Safari FindOnPageMatchesWordStartsOnly -bool false
# Enable the Develop menu and the Web Inspector in Safari
/usr/bin/defaults write com.apple.Safari IncludeDevelopMenu -bool true
/usr/bin/defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true
/usr/bin/defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true
# Add a context menu item for showing the Web Inspector in web views
/usr/bin/defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
log "Setting Chrome Defaults ..."
/usr/bin/defaults write com.google.Chrome ExtensionInstallSources -array "https://*.github.com/*" "http://userscripts.org/*"
/usr/bin/defaults write com.google.Chrome.canary ExtensionInstallSources -array "https://*.github.com/*" "http://userscripts.org/*"
log "Restarting Applications ..."
for app in "Safari" "Finder"; do
killall "$app" > /dev/null 2>&1
done
warning "Done. Note that some of these changes require a logout/restart to take effect."
# Remove functions
unset log
unset warning
unset installcask
unset brewski
unset ascii