This commit is contained in:
admin 2016-10-03 17:17:48 -04:00
parent 8e93ad3ea8
commit ce2c50c6a4
2 changed files with 107 additions and 100 deletions

View File

@ -0,0 +1,37 @@
#!/bin/bash
# make xcode shut up and give us build tools
sudo xcodebuild -license accept
# enable fde
sudo fdesetup enable
# disable hibernate
sudo rm /private/var/vm/sleepimage
sudo pmset -a hibernatemode 0
# enable application firewall
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
sudo defaults write /Library/Preferences/com.apple.alf loggingenabled -bool true
sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -bool false
# hush time machine
sudo defaults write /Library/Preferences/com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# update software
sudo softwareupdate -i -a
# enable all autoupdates
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool TRUE
sudo defaults write /Library/Preferences/com.apple.commerce AutoUpdate -bool TRUE
sudo defaults write /Library/Preferences/com.apple.commerce AutoUpdateRestartRequired -bool TRUE
# disable guest user account
sudo defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool false
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool false
# install three python modules systemwide, that's all
# do the rest with pip install --user in homedir
sudo easy_install pip
sudo /usr/local/bin/pip install virtualenv
sudo /usr/local/bin/pip install awscli

View File

@ -1,109 +1,58 @@
#!/bin/bash #!/bin/bash
###################################### Configure sane user preference defaults
# make xcode shut up and give us build tools
sudo xcodebuild -license accept
# enable fde
sudo fdesetup enable
# disable hibernate
sudo rm /private/var/vm/sleepimage
sudo pmset -a hibernatemode 0
# enable application firewall
sudo defaults write /Library/Preferences/com.apple.alf globalstate -int 1
sudo defaults write /Library/Preferences/com.apple.alf loggingenabled -bool true
sudo defaults write /Library/Preferences/com.apple.alf stealthenabled -bool false
# hush time machine
sudo defaults write /Library/Preferences/com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# update software
sudo softwareupdate -i -a
# enable all autoupdates
sudo defaults write /Library/Preferences/com.apple.SoftwareUpdate AutomaticCheckEnabled -bool TRUE
sudo defaults write /Library/Preferences/com.apple.commerce AutoUpdate -bool TRUE
sudo defaults write /Library/Preferences/com.apple.commerce AutoUpdateRestartRequired -bool TRUE
# disable guest user account
sudo defaults write /Library/Preferences/com.apple.AppleFileServer guestAccess -bool false
sudo defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server AllowGuestAccess -bool false
# black like my soul # black like my soul
defaults write NSGlobalDomain AppleInterfaceStyle Dark defaults write NSGlobalDomain AppleInterfaceStyle Dark
# hide menu bar # hide menu bar
defaults write NSGlobalDomain _HIHideMenuBar -bool true defaults write NSGlobalDomain _HIHideMenuBar -bool true
# dock on left # dock on left
defaults write com.apple.dock orientation left defaults write com.apple.dock orientation left
# autohide dock # autohide dock
defaults write com.apple.dock autohide -bool true defaults write com.apple.dock autohide -bool true
# do not save to icloud drive by default # do not save to icloud drive by default
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool FALSE defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool FALSE
# airdrop on all interfaces # airdrop on all interfaces
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
# disable spotlight search spyware ugh thx # disable spotlight search spyware ugh thx
defaults write com.apple.lookup.shared LookupSuggestionsDisabled -int 1 defaults write com.apple.lookup.shared LookupSuggestionsDisabled -int 1
defaults write com.apple.Safari UniversalSearchEnabled -int 0 defaults write com.apple.Safari UniversalSearchEnabled -int 0
# show battery percentage # show battery percentage
defaults write com.apple.menuextra.battery ShowPercent -bool TRUE defaults write com.apple.menuextra.battery ShowPercent -bool TRUE
# ask for password after 5 seconds of screen saver # ask for password after 5 seconds of screen saver
defaults write com.apple.screensaver askForPassword -int 1 defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 30 defaults write com.apple.screensaver askForPasswordDelay -int 30
# bottom right corner to lock screen # bottom right corner to lock screen
defaults write com.apple.dock "wvous-br-corner" -int 5 defaults write com.apple.dock "wvous-br-corner" -int 5
defaults write com.apple.dock "wvous-br-modifier" -int 0 defaults write com.apple.dock "wvous-br-modifier" -int 0
# 10 minute screensaver activation
# 2 minute screensaver activation
defaults write com.apple.screensaver idleTime -int 600 defaults write com.apple.screensaver idleTime -int 600
# terminal utf8 only
# terminal
# utf8 only
defaults write com.apple.Terminal StringEncodings -array 4 defaults write com.apple.Terminal StringEncodings -array 4
# close window if shell exited cleanly # close terminal window if shell exited cleanly
defaults write com.apple.Terminal ShellExitAction 2 defaults write com.apple.Terminal ShellExitAction 2
defaults write com.apple.Terminal FontAntialias 1 defaults write com.apple.Terminal FontAntialias 1
defaults write com.apple.Terminal "Default Window Settings" "Pro" defaults write com.apple.Terminal "Default Window Settings" "Pro"
defaults write com.apple.Terminal "Startup Window Settings" "Pro" defaults write com.apple.Terminal "Startup Window Settings" "Pro"
# New Finder windows use ~ # New Finder windows use ~
defaults write com.apple.finder NewWindowTarget -string "PfHm" defaults write com.apple.finder NewWindowTarget -string "PfHm"
# don't show mounted volumes on desktop # don't show mounted volumes on desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -int 0 defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -int 0
defaults write com.apple.finder ShowRemovableMediaOnDesktop -int 0 defaults write com.apple.finder ShowRemovableMediaOnDesktop -int 0
# finder show all file extensions # finder show all file extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# set menubar clock to 24h with date and seconds # set menubar clock to 24h with date and seconds
defaults write com.apple.menuextra.clock DateFormat -string 'EEE MMM d H:mm:ss' defaults write com.apple.menuextra.clock DateFormat -string 'EEE MMM d H:mm:ss'
# set keyboard to be really fucking fast # set keyboard to be really fucking fast
defaults write -g InitialKeyRepeat -int 15 # normal minimum is 15 (225 ms) # normal minimum is 15 (225 ms)
defaults write -g KeyRepeat -int 1 # normal minimum is 2 (30 ms) defaults write NSGlobalDomain InitialKeyRepeat -int 15
# normal minimum is 2 (30 ms)
defaults write NSGlobalDomain KeyRepeat -int 1
# safari debug stuff # safari debug stuff
defaults write com.apple.Safari IncludeDevelopMenu -bool true defaults write com.apple.Safari IncludeDevelopMenu -bool true
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true defaults write com.apple.Safari \
WebKitDeveloperExtrasEnabledPreferenceKey -bool true
defaults write com.apple.Safari "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true defaults write com.apple.Safari "com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled" -bool true
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
######################################################### set default inputrc
# install three python modules systemwide, that's all
# do the rest with pip install --user in homedir
sudo easy_install pip
sudo /usr/local/bin/pip install virtualenv
sudo /usr/local/bin/pip install awscli
# set default inputrc:
cat > ~/.inputrc <<EOF cat > ~/.inputrc <<EOF
set show-all-if-ambiguous on set show-all-if-ambiguous on
set completion-ignore-case on set completion-ignore-case on
@ -114,17 +63,14 @@ set show-all-if-unmodified on
set completion-map-case on set completion-map-case on
set horizontal-scroll-mode Off set horizontal-scroll-mode Off
EOF EOF
############################################## install homebrew under homedir
# install homebrew under homedir
if [[ ! -d ~/Library/Homebrew ]]; then if [[ ! -d ~/Library/Homebrew ]]; then
mkdir -p ~/Library/Homebrew mkdir -p ~/Library/Homebrew
cd ~/Library/Homebrew cd ~/Library/Homebrew
curl -fsSL https://github.com/Homebrew/brew/tarball/master | \ curl -fsSL https://github.com/Homebrew/brew/tarball/master | \
tar --strip-components 1 -xvf - tar --strip-components 1 -xvf -
fi fi
######################################## setup modular bashrc.d and profile.d
# setup modular bashrc.d and profile.d
if [[ ! -d ~/Library/bashrc.d ]]; then
cat > ~/.bashrc <<'EOF' cat > ~/.bashrc <<'EOF'
# do not edit this file. put files in the dir below. # do not edit this file. put files in the dir below.
for FN in $HOME/Library/bashrc.d/*.sh ; do for FN in $HOME/Library/bashrc.d/*.sh ; do
@ -133,9 +79,6 @@ done
EOF EOF
mkdir -p ~/Library/bashrc.d mkdir -p ~/Library/bashrc.d
touch ~/Library/bashrc.d/keep.sh touch ~/Library/bashrc.d/keep.sh
fi
if [[ ! -d ~/Library/profile.d ]]; then
cat > ~/.profile <<'EOF' cat > ~/.profile <<'EOF'
# do not edit this file. put files in the dir below. # do not edit this file. put files in the dir below.
source ~/.bashrc source ~/.bashrc
@ -145,23 +88,22 @@ done
EOF EOF
mkdir -p ~/Library/profile.d mkdir -p ~/Library/profile.d
touch ~/Library/profile.d/keep.sh touch ~/Library/profile.d/keep.sh
fi ####################################################### install homebrew path
cat > ~/Library/bashrc.d/100homebrew.sh <<'EOF'
# install homebrew path export PATH+=":$HOME/Library/Homebrew/bin"
if [[ ! -e ~/Library/bashrc.d/100homebrew.sh ]]; then export PATH+=":$HOME/Library/Homebrew/sbin"
mkdir -p ~/Library/bashrc.d export HOMEBREW_NO_ANALYTICS=1
echo 'export PATH+=":~/Library/Homebrew/bin"' > \ EOF
~/Library/bashrc.d/100homebrew.sh ####################################### Set caskroom to install under homedir
echo 'export PATH+=":~/Library/Homebrew/sbin"' >> \ echo '
~/Library/bashrc.d/100homebrew.sh cat > ~/Library/bashrc.d/100homebrewcaskdir.sh <<'EOF'
echo 'export HOMEBREW_NO_ANALYTICS=1' >> \ export HOMEBREW_CASK_OPTS="--appdir=$HOME/Applications"
~/Library/bashrc.d/100homebrew.sh EOF
echo 'export HOMEBREW_CASK_OPTS="--appdir=~/Applications"' > \ ##################################################################### set PS1
~/Library/bashrc.d/100homebrewcaskdir.sh cat > ~/Library/bashrc.d/000.ps1.sh <<'EOF'
fi export PS1='\u@\h:\w\\$ '
EOF
echo 'export PS1=\'\u@\h:\w\\$ \'' > ~/Library/bashrc.d/000.ps1.sh ############################################################ enable git prompt
cat > ~/Library/bashrc.d/200.git-prompt.sh <<'EOF' cat > ~/Library/bashrc.d/200.git-prompt.sh <<'EOF'
if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then
GIT_PROMPT_THEME=Default GIT_PROMPT_THEME=Default
@ -169,17 +111,46 @@ if [ -f "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" ]; then
source "$(brew --prefix bash-git-prompt)/share/gitprompt.sh" source "$(brew --prefix bash-git-prompt)/share/gitprompt.sh"
fi fi
EOF EOF
########################################## enable bash completion in homebrew
cat > ~/Library/bashrc.d/900.homebrew-completion.sh <<'EOF'
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
EOF
################################################################### GPG Agent
cat > ~/Library/profile.d/900.gpg-agent.sh <<'EOF'
# check for existing running agent info
if [[ -e $HOME/.gpg-agent-info ]]; then
source $HOME/.gpg-agent-info
export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
fi
# set homebrew path: # test existing agent, remove info file if not working
ssh-add -L 2>/dev/null >/dev/null || rm -f $HOME/.gpg-agent-info
# if no info file, start up potentially-new, working agent
if [[ ! -e $HOME/.gpg-agent-info ]]; then
gpg-agent --enable-ssh-support --daemon --write-env-file \
2>&1 >/dev/null
fi
# load up new agent info
if [[ -e $HOME/.gpg-agent-info ]]; then
source $HOME/.gpg-agent-info
export GPG_AGENT_INFO SSH_AUTH_SOCK SSH_AGENT_PID
fi
EOF
#############################################################################
### load up profile scripts / paths for the rest of this configuration script
source ~/.profile source ~/.profile
####################################################### install caskroom apps
if [[ ! -d ~/Applications ]]; then if [[ ! -d ~/Applications ]]; then
mkdir -p ~/Applications mkdir -p ~/Applications
fi fi
brew tap caskroom/cask brew tap caskroom/cask
CASKS=" CASKS="
atom
disk-inventory-x
github-desktop github-desktop
google-chrome google-chrome
google-drive google-drive
@ -190,13 +161,10 @@ CASKS="
slack slack
sublime-text sublime-text
" "
for CASK in $CASKS ; do for CASK in $CASKS ; do
brew cask install $CASK brew cask install $CASK
done done
#################################################### install homebrew packages
# install homebrew packages
HOMEBREW_PKGS=" HOMEBREW_PKGS="
autoconf autoconf
automake automake
@ -228,7 +196,6 @@ HOMEBREW_PKGS="
jq jq
keybase keybase
lame lame
lame
mobile-shell mobile-shell
mtr mtr
mutt mutt
@ -259,3 +226,6 @@ for PKG in $HOMEBREW_PKGS ; do
brew install $PKG brew install $PKG
done done
############################################# look for vimrc in google drive
ln -s ~/Google\ Drive/Dotfiles/vimrc ~/.vimrc