-
Notifications
You must be signed in to change notification settings - Fork 1
/
.macrc
96 lines (81 loc) · 3.58 KB
/
.macrc
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
#!/bin/bash
if [[ "${TERM_PROGRAM}" = "Apple_Terminal" || "${TERM_PROGRAM}" =~ iTerm ]]; then
# additional config for Mac OS X to maintain sanity
alias aptsearch='brew search'
alias aptshow='brew info'
alias aptinstall='brew install'
alias aptgrade='softwareupdate --install --all'
alias md5sum='md5 -r'
alias sed='gsed'
alias timeout='gtimeout'
alias grep='ggrep'
brew_pkgs_to_install=(
git
gsed
grep
base64
coreutils
lastpass-cli
mysql
bash
)
# easier editing of ~/.bash_history when it's chattr'ed to prevent anything but appending
#actually, this may not work if there are changes to the live file when editing the temp copy :(
alias edit-history='chflags nouappend ~/.bash_history && vim ~/.bash_history && chflags uappend ~/.bash_history'
# unsets the 'whois' function from ~/.bashrc
unset -f whois
# change some Finder options
# <http://ianlunn.co.uk/articles/quickly-showhide-hidden-files-mac-os-x-mavericks/>
DEFAULTS_CHANGED=0
for option in \
AppleShowAllFiles \
_FXShowPosixPathInTitle; do
if [[ $(defaults read com.apple.finder "${option}" | egrep -qi "no|0"; echo $?) = 0 ]]; then
defaults write com.apple.finder "${option}" YES
DEFAULTS_CHANGED=1
fi
done
if [[ "${DEFAULTS_CHANGED}" = 1 ]]; then
killall Finder /System/Library/CoreServices/Finder.app
fi
# auto-hide the dock, and reduce the delay in showing it
# defaults write com.apple.dock autohide -bool true &&
# defaults write com.apple.dock autohide-delay -float 0 &&
# defaults write com.apple.dock autohide-time-modifier -float 0.5 &&
# killall Dock
if [[ $(defaults read com.apple.notificationcenterui bannerTime) -ne 3 ]]; then
# reduce timeout for banner notifications
defaults write com.apple.notificationcenterui bannerTime 3
pkill -l NotificationCenter
fi
# reset timeout for banner notifications
#defaults delete com.apple.notificationcenterui bannerTime
#install terminal-notifier if it's not already installed
if [[ $(which ruby) ]]; then
[[ $(gem list | grep terminal-notifier) ]] ||
sudo gem install terminal-notifier
else
echo "please install ruby to continue"
fi
# enable color support of ls and also add handy aliases
if [[ "${TERM}" != "dumb" ]]; then
alias ls='ls -G'
fi
# remove any references to :/usr/local/bin in the PATH
[[ "${PATH}" =~ :/usr/local/bin(:|$) ]] && PATH="${PATH//:\/usr\/local\/bin}"
# ensure /usr/local/bin is the first directory in the user's PATH
if [[ ! $(echo ${PATH} | grep "^/usr/local/bin") ]]; then
export PATH="/usr/local/bin:${PATH}"
fi
[[ "${PATH}" =~ /usr/local/Cellar/bin ]] || export PATH="${PATH}:/usr/local/Cellar/bin/"
# don't disconnect from the network when locking the screen
# from <http://apple.stackexchange.com/a/97047>
# sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport en0 prefs DisconnectOnLogout=NO
# prevent Finder from showing up in the app switcher
# from <http://osxdaily.com/2012/02/13/remove-finder-from-the-commandtab-application-switcher-in-mac-os-x/>
# it seems impossible to edit the file under Mac OS X Sierra due to System Integrity Protection
#if [[ ! $(grep '<key>NSUIElement</key>\n\s+<string>1</string>' /System/Library/CoreServices/Finder.app/Contents/Info.plist) ]]; then
# sudo sed '0,/<dict>/s;<dict>;<dict>\n <key>NSUIElement</key>\n <string>1</string>;' \
# /System/Library/CoreServices/Finder.app/Contents/Info.plist
#fi
fi