Last active
July 25, 2023 16:02
-
-
Save manuelselbach/71bb94c13e100b080832 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" | |
} | |
##### SSH | |
sshConfig=~/.ssh/config | |
# 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" | |
# Install Xcode cli tools | |
# xcode-select --install | |
#################### | |
# Check for Homebrew, | |
# Install if we don't have it | |
if test ! $(which brew); then | |
echo "[+] Installing homebrew ..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
fi | |
#################### | |
# Update homebrew recipes | |
brew update | |
binaries=( | |
python | |
node | |
tree | |
the_silver_searcher | |
git | |
dnsmasq | |
htop | |
wget | |
postgresql | |
) | |
echo "[+] installing binaries ..." | |
brew install ${binaries[@]} | |
echo "[+] configure dnsmasq to use *.localhost -> 127.0.0.1 as wildcard for local development ..." | |
cd $(brew --prefix); | |
if [ ! -d "etc" ]; then | |
mkdir etc | |
fi; | |
echo 'address=/.localhost/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 | |
if [ ! -d "/etc/resolver" ]; then | |
sudo mkdir -p /etc/resolver | |
fi | |
sudo bash -c 'echo "nameserver 127.0.0.1" > /etc/resolver/localhost' | |
cd - | |
echo "[+] cleaning up brew ..." | |
brew cleanup | |
# Important December 2015 update: Homebrew-Cask will now be kept up to date together with Homebrew (see #15381 for details). If you haven’t yet, run brew uninstall --force brew-cask; brew update to switch to the new system. | |
# echo "[+] install Homebrew Cask ..." | |
# brew install caskroom/cask/brew-cask | |
# Apps | |
apps=( | |
google-chrome | |
firefox | |
appcleaner | |
iterm2 | |
sublime-text | |
virtualbox | |
sourcetree | |
vlc | |
skype | |
slack | |
macdown | |
sequel-ace | |
burp-suite | |
keka | |
shuttle | |
cyberduck | |
doxygen | |
libreoffice | |
mysqlworkbench | |
yed | |
diffmerge | |
phpstorm | |
imageoptim | |
paparazzi | |
pgadmin4 | |
docker | |
insomnia | |
jumpcut | |
) | |
# Install apps to /Applications | |
# Default is: /Users/$user/Applications | |
echo "[+] installing apps ..." | |
brew install --cask --appdir="/Applications" ${apps[@]} | |
# Install ddev | |
echo "[+] install ddev" | |
brew tap drud/ddev && brew install ddev | |
# Install Quicklook features | |
quicklookFeatures=( | |
qlcolorcode | |
quicklook-json | |
qlprettypatch | |
qlstephen | |
qlmarkdown | |
quicklook-csv | |
qlrest | |
betterzip | |
qlimagesize | |
webpquicklook | |
suspicious-package | |
) | |
echo "[+] install quicklook features ..." | |
brew install --cask ${quicklookFeatures[@]} | |
brew tap homebrew/cask-versions | |
#################### | |
# 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 top-left hotspot start screensaver | |
defaults write com.apple.dock wvous-tl-corner -int 5 && \ | |
defaults write com.apple.dock wvous-tl-modifier -int 0 | |
# Make bottom-left hotspot show desktop | |
defaults write com.apple.dock wvous-bl-corner -int 4 && \ | |
defaults write com.apple.dock wvous-bl-modifier -int 0 | |
# 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 | |
# Show icons for hard drives, servers, and removable media on the desktop | |
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true && \ | |
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true && \ | |
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true && \ | |
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true | |
# Avoid creating .DS_Store files on network volumes | |
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true | |
# Disable disk image verification | |
defaults write com.apple.frameworks.diskimages skip-verify -bool true && \ | |
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true && \ | |
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true | |
# Trackpad: map bottom right corner to right-click | |
# defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 && \ | |
# defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true && \ | |
# defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 && \ | |
# defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -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 | |
# Auto-play videos when opened with QuickTime Player | |
# defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1 | |
# Enable AirDrop over Ethernet and on unsupported Macs | |
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true | |
# Disable WebkitNightly.app's homepage | |
# defaults write org.webkit.nightly.WebKit StartPageDisabled -bool true | |
# Disable warning on emptying the trash | |
defaults write com.apple.finder WarnOnEmptyTrash -bool false | |
killall Finder | |
killall Dock | |
# Set Hostname to manuel-selbach | |
# sudo scutil --set HostName manuel-selbach | |
# activate special chars for git | |
git config --global core.precomposeunicode true | |
# needs to be installed manually | |
echo '##############################################' | |
echo '[+] Install this:' | |
echo '-> SQL Profiler: http://www.profilesql.com/download/' | |
echo '-> bookmarks for ZSH: https://github.com/jocelynmallon/zshmarks' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment