Skip to content

Instantly share code, notes, and snippets.

@j6s
Last active January 23, 2018 00:36
Show Gist options
  • Save j6s/6cda5029d9c166d6dcc9 to your computer and use it in GitHub Desktop.
Save j6s/6cda5029d9c166d6dcc9 to your computer and use it in GitHub Desktop.
onetimesetup.sh
#!/bin/sh
##############################################################################################################
# onetime setup script for mac, including homebrew, some apps and some settings #
# full dotfile repository coming soon #
##############################################################################################################
# Ask for the administrator password upfront
sudo -v
# Keep-alive: update existing `sudo` time stamp until this script has finished
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
mkdir ~/tmp
cd ~/tmp
mkdir -p ~/Library/Fonts/
echo "homebrew: installing";
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)";
echo "homebre: done";
echo "";
echo "composer: installing";
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
echo "done";
# ---------------- command line tool installation -------------
brew update
brew install git
brew install zsh
brew install graphicsmagick
brew install coreutils
brew install id3tool
brew install colordiff
brew install htop-osx
brew install wget
brew install tree
brew install mc
brew install git
brew install caskroom/cask/brew-cask
brew install unzip
brew install android-sdk
# ------------- graphical tool installation -----------------
export HOMEBREW_CASK_OPTS="--appdir=/Applications"
brew cask
brew update
brew cask install google-chrome
brew cask install sublime-text
brew cask install skype
brew cask install phpstorm
brew cask install intellij-idea-ce
brew cask install firefox
brew cask install dropbox
brew cask install spotify
brew cask install node
brew cask install mamp
brew cask install mou
brew cask install evernote
brew cask install flux
brew cask install imageoptim
brew cask install transmit
brew cask install vlc
brew cask install libreoffice
brew cask install onepassword
brew cask install alfred
brew cask install cinch
brew cask install daisydisk
brew cask install gpgtools
# -------------------- font installation ---------------
brew tap caskroom/fonts
brew update
brew cask install font-roboto
brew cask install font-roboto-slab
brew cask install font-ubuntu
brew cask install font-anonymous-pro
brew cask install font-droid-sans
brew cask install font-droid-sans-mono
brew cask install font-droid-serif
brew cask install font-nexa
brew cask install font-open-sans
brew cask install font-open-sans-condensed
brew cask install font-source-code-pro
wget http://optimate.dl.sourceforge.net/project/linuxlibertine/linuxlibertine/5.3.0/LinLibertineOTF_5.3.0_2012_07_02.tgz
tar zxvf LinLibertineOTF_5.3.0_2012_07_02.tgz
mv *.otf ~/Library/Fonts/
# --------------- global npm modules ------------------
sudo npm install -g less
sudo npm install -g grunt-cli
sudo npm install -g bower
# ------------------ oh my zsh ------------------------
chsh -s /usr/local/bin/zsh
wget --no-check-certificate https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | sh
# --------------------------------- settings ----------------------------------
# #############################################################################
# # FINDER #
# #############################################################################
# ######## Desktop ########
# 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
# Show item info near icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:showItemInfo true" ~/Library/Preferences/com.apple.finder.plist
# Show item info to the right of the icons on the desktop
/usr/libexec/PlistBuddy -c "Set DesktopViewSettings:IconViewSettings:labelOnBottom false" ~/Library/Preferences/com.apple.finder.plist
# Enable snap-to-grid for icons on the desktop and in other icon views
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
# ######## General ########
#enable copy & paste in quick look
defaults write com.apple.finder QLEnableTextSelection -bool TRUE
# show hidden files in Finder
defaults write com.apple.finder AppleShowAllFiles -bool YES
# Finder: allow quitting via ⌘ + Q; doing so will also hide desktop icons
defaults write com.apple.finder QuitMenuItem -bool true
# Finder: show all filename extensions
defaults write NSGlobalDomain AppleShowAllExtensions -bool true
# When performing a search, search the current folder by default
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Automatically open a new Finder window when a volume is mounted
defaults write com.apple.frameworks.diskimages auto-open-ro-root -bool true
defaults write com.apple.frameworks.diskimages auto-open-rw-root -bool true
defaults write com.apple.finder OpenWindowForNewRemovableDisk -bool true
# Use column view in all Finder windows by default
# Four-letter codes for the other view modes: `icnv`, `clmv`, `Flwv`
defaults write com.apple.finder FXPreferredViewStyle -string "clmv"
# Display full POSIX path as Finder window title
defaults write com.apple.finder _FXShowPosixPathInTitle -bool true
# show Library Folder
chflags nohidden ~/Library/
# Avoid creating .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# ####### diable warnings ########
# Disable the warning when changing a file extension
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
# Disable the warning before emptying the Trash
defaults write com.apple.finder WarnOnEmptyTrash -bool false
# #############################################################################
# # DOCK #
# #############################################################################
# ########## General ########
# Position (left, bottom, right)
defaults write com.apple.dock orientation -string "left"
# transparent hidden apps in Dock
defaults write com.apple.Dock showhidden -bool YES
# Set the icon size of Dock items to 24 pixels
defaults write com.apple.dock tilesize -int 24
# Minimize windows into their application’s icon
defaults write com.apple.dock minimize-to-application -bool true
# Show indicator lights for open applications in the Dock
defaults write com.apple.dock show-process-indicators -bool true
# ######## animations ########
# no delay for showing hidden dock
defaults write com.apple.Dock autohide-delay -float 0
# speed up mission control animation
defaults write com.apple.dock expose-animation-duration -float 0.12
# Wipe all (default) app icons from the Dock
# This is only really useful when setting up a new Mac, or if you don’t use
# the Dock to launch apps.
defaults write com.apple.dock persistent-apps -array ""
# #############################################################################
# # stupid DASHBOARD #
# #############################################################################
#disable dashboard
defaults write com.apple.dashboard mcx-disabled -boolean YES
# Don’t show Dashboard as a Space
defaults write com.apple.dock dashboard-in-overlay -bool true
# #############################################################################
# # TRACKPAD & MOUSE & KEYBOARD #
# #############################################################################
# Trackpad: enable tap to click for this user and for the login screen
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Use scroll gesture with the Ctrl (^) modifier key to zoom
defaults write com.apple.universalaccess closeViewScrollWheelToggle -bool true
defaults write com.apple.universalaccess HIDScrollZoomModifierMask -int 262144
# Follow the keyboard focus while zoomed in
defaults write com.apple.universalaccess closeViewZoomFollowsFocus -bool true
# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# #############################################################################
# # TIME MACHINE #
# #############################################################################
# Disable local Time Machine snapshots
sudo tmutil disablelocal
# Prevent Time Machine from prompting to use new hard drives as backup volume
defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
# #############################################################################
# # MAIL #
# #############################################################################
# Add the keyboard shortcut ⌘ + Enter to send an email in Mail.app
defaults write com.apple.mail NSUserKeyEquivalents -dict-add "Send" -string "@\\U21a9"
# #############################################################################
# # ACTIVITY MONITOR #
# #############################################################################
# Show all processes in Activity Monitor
defaults write com.apple.ActivityMonitor ShowCategory -int 0
# Sort Activity Monitor results by CPU usage
defaults write com.apple.ActivityMonitor SortColumn -string "CPUUsage"
defaults write com.apple.ActivityMonitor SortDirection -int 0
# #############################################################################
# # DEBUG MENUS #
# #############################################################################
# Enable the debug menu in Address Book
defaults write com.apple.addressbook ABShowDebugMenu -bool true
# Enable the debug menu in Disk Utility
defaults write com.apple.DiskUtility DUDebugMenuEnabled -bool true
defaults write com.apple.DiskUtility advanced-image-options -bool true
# Enable the WebKit Developer Tools in the Mac App Store
defaults write com.apple.appstore WebKitDeveloperExtras -bool true
# Enable Debug Menu in the Mac App Store
defaults write com.apple.appstore ShowDebugMenu -bool true
# swipe between pages with three fingers
defaults write NSGlobalDomain AppleEnableSwipeNavigateWithScrolls -bool true
defaults -currentHost write NSGlobalDomain com.apple.trackpad.threeFingerHorizSwipeGesture -int 1
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerHorizSwipeGesture -int 1
# Set a faster doubleclick threshold
defaults write NSGlobalDomain com.apple.mouse.doubleClickThreshold -float 0.8
# global mouse tracking speed (1...5)
defaults write NSGlobalDomain com.apple.mouse.scaling -float 4
# global trackpad tracking speed (1...5)
defaults write NSGlobalDomain com.apple.trackpad.scaling -int 4
# global scrolling speed (1...5)
defaults write NSGlobalDomain com.apple.scrollwheel.scaling -float 1
# stop all those damn noises
defaults write NSGlobalDomain com.apple.sound.beep.feedback -bool false
# use "natural" lion-style scrolling
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool true
# Automatically illuminate built-in MacBook keyboard in low light
defaults write com.apple.BezelServices kDim -bool true
# Enable access for assistive devices
echo -n 'a' | sudo tee /private/var/db/.AccessibilityAPIEnabled > /dev/null 2>&1
sudo chmod 444 /private/var/db/.AccessibilityAPIEnabled
# Require password immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 0
# Ask for password after 5 seconds
defaults write com.apple.screensaver askForPassword -int 1
defaults write com.apple.screensaver askForPasswordDelay -int 5
# Smart zoom enabled, double-tap with one finger (set to 0 to disable)
defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseOneFingerDoubleTapGesture -int 0
# Tap with two fingers to emulate right click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true
# Enable three finger tap (look up)
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerTapGesture -int 2
# Enable three finger drag
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerDrag -bool true
# Zoom in or out
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadPinch -bool true
# Smart zoom, double-tap with two fingers
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadTwoFingerDoubleTapGesture -bool false
# Rotate
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRotate -bool true
# Swipe between pages with two fingers
defaults write NSGlobalDomain AppleEnableSwipeNavigateWithScrolls -bool true
# Enable other multi-finger gestures
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadThreeFingerVertSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerVertSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerPinchGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFourFingerHorizSwipeGesture -int 2
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadFiveFingerPinchGesture -int 2
defaults write com.apple.dock showMissionControlGestureEnabled -bool true
defaults write com.apple.dock showAppExposeGestureEnabled -bool true
defaults write com.apple.dock showDesktopGestureEnabled -bool true
defaults write com.apple.dock showLaunchpadGestureEnabled -bool true
# #############################################################################
# # CONTACTS & CALENDAR #
# #############################################################################
# sort by lastname
defaults write com.apple.AddressBook ABNameSortingFormat -string "sortingLastName sortingFirstName"
# Show week numbers (10.8 only)
defaults write com.apple.iCal "Show Week Numbers" -bool true
# Show 7 days
defaults write com.apple.iCal "n days of week" -int 7
# Week starts on monday
defaults write com.apple.iCal "first day of week" -int 1
# Show event times
defaults write com.apple.iCal "Show time in Month View" -bool true
# #############################################################################
# # stuff #
# #############################################################################
# store screenshots in Dropbox
defaults write com.apple.screencapture location ~/Dropbox/03_PICTURES/Screenshots
# Automatically quit printer app once the print jobs complete
defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true
# Disable Resume system-wide
defaults write NSGlobalDomain NSQuitAlwaysKeepsWindows -bool false
# Disable Notification Center and remove the menu bar icon
launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist 2> /dev/null
# Set language and text formats
# Note: if you’re in the US, replace `EUR` with `USD`, `Centimeters` with
# `Inches`, `en_GB` with `en_US`, and `true` with `false`.
defaults write NSGlobalDomain AppleLanguages -array "en" "de"
defaults write NSGlobalDomain AppleLocale -string "de_DE@currency=EUR"
defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
defaults write NSGlobalDomain AppleMetricUnits -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
# dissable the “reopen windows when logging back in” option
# This works, although the checkbox will still appear to be checked.
defaults write com.apple.loginwindow TALLogoutSavesState -bool false
defaults write com.apple.loginwindow LoginwindowLaunchesRelaunchApps -bool false
#disable icloud saving
defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false
# Expand save panel by default
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
# Expand print panel by default
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
# Reveal IP address, hostname, OS version, etc. via clock in login window
sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName
# Check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1
for app in "Activity Monitor" "Address Book" "Calendar" "Contacts" "cfprefsd" \
"Dock" "Finder" "Mail" "Messages" "SystemUIServer" \
"iCal"; do
killall "${app}" > /dev/null 2>&1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment