-
-
Save helhum/ac066d7f32a687e30a2873839c4035ab to your computer and use it in GitHub Desktop.
Install script for my personal tool chain (Mac OS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
# insert a line to a file if the line does not already exist | |
# - first parameter is the file to insert the line | |
# - second parameter is the line to insert. It'll only be inserted if not already exists | |
# - third parameter is optional. This will override the search behavior. | |
# Instead of searching for the line of parameter 2 this term is used. | |
function insertLineIfNotExists { | |
FILE=$1 | |
LINE=$2 | |
SEARCH_FOR=${3:-"$LINE"} | |
touch $FILE | |
grep -qF "$SEARCH_FOR" "$FILE" || echo "$LINE" >> "$FILE" | |
} | |
# config files | |
bashConfig=~/.bash_profile | |
sshConfig=~/.ssh/config | |
##### SSH | |
# enable autoloading of ssh keys for macOS Sierra | |
if [ ! -f $sshConfig ]; then | |
mkdir -p "`dirname \"$sshConfig\"`" 2>/dev/null | |
touch $sshConfig | |
fi | |
# Adjust SSH config | |
insertLineIfNotExists $sshConfig "AddKeysToAgent yes" | |
insertLineIfNotExists $sshConfig "UseKeychain yes" | |
# Adjust bash config | |
touch $bashConfig | |
grep -qF "Custom bash config" "$bashConfig" || echo -e " | |
# Custom bash config | |
export HOMEBREW_CASK_OPTS=\"$HOMEBREW_CASK_OPTS --appdir=/Applications\" | |
export VISUAL=\"subl -n -w\" | |
export EDITOR=\$VISUAL | |
# Path to the bash it configuration | |
export BASH_IT=\"/Users/egerer/.bash_it\" | |
export BASH_IT_THEME=\"iterate\" | |
# Dont check mail when opening terminal | |
unset MAILCHECK | |
export SCM_CHECK=true | |
source $BASH_IT/bash_it.sh | |
[ -f /usr/local/etc/bash_completion ] && . /usr/local/etc/bash_completion | |
" >> $bashConfig | |
# Install Xcode cli tools | |
xcode-select --install || true | |
#################### | |
# Check for Homebrew, | |
# Install if we don't have it | |
if test ! $(which brew); then | |
echo "[+] Installing homebrew ..." | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
fi | |
brew tap homebrew/php | |
brew tap caskroom/versions | |
#################### | |
# Update homebrew recipes | |
brew update | |
binaries=( | |
ack | |
node | |
tree | |
git | |
dnsmasq | |
htop | |
youtube-dl | |
wget | |
thefuck | |
mas | |
bash-completion | |
sqlmap | |
homebrew/php/php70 | |
homebrew/php/php70-gmagick | |
homebrew/php/php70-mcrypt | |
homebrew/php/php70-xdebug | |
homebrew/php/arcanist | |
) | |
echo "[+] installing binaries ..." | |
brew install ${binaries[@]} | |
echo "[+] configure dnsmasq to use *.dev -> 127.0.0.1 as wildcard for local development ..." | |
cd $(brew --prefix); mkdir -p etc; echo 'address=/.dev/127.0.0.1' > etc/dnsmasq.conf | |
sudo cp -v $(brew --prefix dnsmasq)/homebrew.mxcl.dnsmasq.plist /Library/LaunchDaemons | |
sudo launchctl load -w /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist | |
sudo mkdir -p /etc/resolver | |
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/dev' | |
cd - | |
echo "[+] cleaning up brew ..." | |
brew cleanup | |
# Install apps from Mac Appstore | |
macApps=( | |
497799835 #Xcode | |
# 670592452 #Tyme | |
557168941 #Tweetbot | |
1176895641 #Spark | |
822514576 #'SonicWALL Mobile Connect' | |
) | |
echo "[+] installing apps from mac appstore (you have to be logged in to your iCloud account!) ..." | |
mas install ${macApps[@]} | |
mas upgrade | |
# Apps | |
apps=( | |
firefoxdeveloperedition | |
google-chrome | |
firefox | |
iterm2 | |
sublime-text | |
virtualbox | |
gitkraken | |
slack | |
macdown | |
sequel-pro | |
1password | |
captain | |
cyberduck | |
dash | |
phpstorm | |
imageoptim | |
docker | |
amazon-music | |
dropbox | |
handbrake | |
launchbar | |
teamviewer | |
appcleaner | |
) | |
# Install apps to /Applications | |
# Default is: /Users/$user/Applications | |
echo "[+] installing apps ..." | |
brew cask install ${apps[@]} | |
# Install Quicklook features | |
quicklookFeatures=( | |
qlcolorcode | |
quicklook-json | |
qlprettypatch | |
qlstephen | |
qlmarkdown | |
quicklook-csv | |
qlrest | |
betterzipql | |
qlimagesize | |
webpquicklook | |
suspicious-package | |
) | |
echo "[+] install quicklook features ..." | |
brew cask install ${quicklookFeatures[@]} | |
#################### | |
# Mac Default settings | |
echo "[+] set mac defaults ..." | |
# miniturize on double click | |
defaults write -g AppleMiniaturizeOnDoubleClick -int 0 | |
# enable select and copy text within quicklook | |
defaults write com.apple.finder QLEnableTextSelection -bool TRUE | |
# Enable character repeat on keydown | |
defaults write -g ApplePressAndHoldEnabled -bool false | |
# Set a shorter Delay until key repeat | |
defaults write NSGlobalDomain InitialKeyRepeat -int 12 | |
# Set a blazingly fast keyboard repeat rate | |
defaults write NSGlobalDomain KeyRepeat -int 1 | |
# Disable window animations ("new window" scale effect) | |
# defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false | |
# Turn on dashboard-as-overlay | |
defaults write com.apple.dashboard enabled-state 3 | |
# Use plain text mode for new TextEdit documents | |
defaults write com.apple.TextEdit RichText -int 0 | |
# Make bottom-right hotspot start screensaver | |
defaults write com.apple.dock wvous-br-corner -int 5 && \ | |
defaults write com.apple.dock wvous-br-modifier -int 0 | |
# Make top-left hotspot show desktop | |
defaults write com.apple.dock wvous-bl-corner -int 4 && \ | |
defaults write com.apple.dock wvous-bl-modifier -int 0 | |
# Make top-right hotspot show notification center | |
defaults write com.apple.dock wvous-tr-corner -int 12 && \ | |
defaults write com.apple.dock wvous-tr-modifier -int 0 | |
# Tune the Dock | |
defaults write com.apple.dock autohide -int 1 | |
defaults write com.apple.dock autohide-time-modifier -float 0.7 | |
defaults write com.apple.dock magnification -int 1 | |
defaults write com.apple.dock mineffect -string "genie" | |
defaults write com.apple.dock minimize-to-application -int 0 | |
defaults write com.apple.dock showhidden -int 0 | |
defaults write com.apple.dock tilesize -int 42 | |
defaults write com.apple.dock position-immutable -int 0 | |
# Enable window dragging with 3 fingers | |
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -int 1 | |
# Set default Finder location to home folder (~/) | |
defaults write com.apple.finder NewWindowTarget -string "PfLo" && \ | |
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}" | |
# Expand save panel by default | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true | |
# Disable ext change warning | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# Check for software updates daily, not just once per week | |
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 | |
# Use current directory as default search scope in Finder | |
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf" | |
# Show Path bar in Finder | |
defaults write com.apple.finder ShowPathbar -bool true | |
# Show Status bar in Finder | |
defaults write com.apple.finder ShowStatusBar -bool true | |
# Avoid creating .DS_Store files on network volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
# Enable the Develop menu and the Web Inspector in Safari | |
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true && \ | |
defaults write com.apple.Safari IncludeDevelopMenu -bool true && \ | |
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true && \ | |
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true && \ | |
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true | |
# Show the ~/Library folder | |
chflags nohidden ~/Library | |
# Show absolute path in finder's title bar. | |
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES | |
# Enable AirDrop over Ethernet and on unsupported Macs | |
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true | |
killall Finder | |
killall Dock | |
if [ ! -d ~/.bash_it ]; then | |
git clone --depth=1 https://github.com/Bash-it/bash-it.git ~/.bash_it | |
~/.bash_it/install.sh | |
fi | |
bash-it update | |
bash-it enable plugin git osx | |
reload | |
# activate special chars for git | |
git config --global core.precomposeunicode true | |
# needs to be installed manually | |
echo '##############################################' | |
echo '[+] Install this:' | |
echo '-> Typinator 6 http://www.ergonis.com/downloads/archive/typinator/Typinator611-Install.dmg' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment