#!/usr/bin/env bash echo "Starting bootstrapping" # 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 update brew tap homebrew/core brew install coreutils #brew install gnu-sed --with-default-names #brew install gnu-tar --with-default-names #brew install gnu-indent --with-default-names #brew install gnu-which --with-default-names #brew install gnu-grep --with-default-names # Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed brew install findutils # Install Bash 4 brew install bash PACKAGES=( ansible bash-completion composer git #htop mc npm ssh-copy-id tree vim wget ) echo "Installing packages..." brew install ${PACKAGES[@]} echo "Cleaning up..." brew cleanup echo "Installing cask..." brew install homebrew-cask CASKS=( appcleaner google-chrome google-backup-and-sync iterm2 phpstorm postman sequel-pro skype spotify tableplus teamviewer tunnelblick vlc ) echo "Installing cask apps..." brew cask install ${CASKS[@]} echo "Installing fonts..." brew tap caskroom/fonts FONTS=( font-hack-nerd-font font-roboto font-source-sans-pro ) brew cask install ${FONTS[@]} echo "Configuring OSX..." # Show the ~/Library folder chflags nohidden ~/Library # Show the /Volumes folder sudo chflags nohidden /Volumes # Disable the “Are you sure you want to open this application?” dialog defaults write com.apple.LaunchServices LSQuarantine -bool false # Show language menu in the top right corner of the boot screen sudo defaults write /Library/Preferences/com.apple.loginwindow showInputMenu -bool true # Save screenshots to Google Drive defaults write com.apple.screencapture location -string "${HOME}/Google Drive/ScreenShots" # Disable shadow in screenshots defaults write com.apple.screencapture disable-shadow -bool true # Avoid creating .DS_Store files on network or USB volumes defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true # Disable Dashboard defaults write com.apple.dashboard mcx-disabled -bool true # Use plain text mode for new TextEdit documents defaults write com.apple.TextEdit RichText -int 0 # Open and save files as UTF-8 in TextEdit defaults write com.apple.TextEdit PlainTextEncoding -int 4 defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4 # 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 # Disable continuous spell checking defaults write com.apple.messageshelper.MessageController SOInputLineSettings -dict-add "continuousSpellCheckingEnabled" -bool false #################################### # NSGlobalDomain # #################################### # Enable tap-to-click defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 # Show filename extensions by default defaults write NSGlobalDomain AppleShowAllExtensions -bool true # Set fast key repeat rate defaults write NSGlobalDomain KeyRepeat -int 0 defaults write NSGlobalDomain InitialKeyRepeat -int 15 defaults write NSGlobalDomain com.apple.keyboard.fnState -int 1 # Set sidebar icon size to small # Possible values: 1 small, 2 medium, 3 large defaults write NSGlobalDomain NSTableViewDefaultSizeMode -int 1 # WhenScrolling show scrollbars # Possible values: `WhenScrolling`, `Automatic` and `Always` defaults write NSGlobalDomain AppleShowScrollBars -string "WhenScrolling" defaults write NSGlobalDomain AppleWindowTabbingMode -string "always" defaults write NSGlobalDomain AppleActionOnDoubleClick -string "Maximize" defaults write NSGlobalDomain AppleAquaColorVariant -int 1 defaults write NSGlobalDomain AppleMiniaturizeOnDoubleClick -bool false #################################### # Finder # #################################### defaults write com.apple.finder ShowStatusBar -bool true defaults write com.apple.finder ShowPathbar -bool true defaults write com.apple.finder ShowSidebar -bool true defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true defaults write com.apple.finder ShowMountedServersOnDesktop -bool true defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true defaults write com.apple.finder ShowRecentTags -bool false # Use list view in all Finder windows by default # Possible values: `icnv`, `clmv`, `Flwv` `Nlsv` defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv" defaults write com.apple.finder FXPreferredGroupBy -string "None" defaults write com.apple.finder FXICloudDriveEnabled -bool true defaults write com.apple.finder FXICloudDriveDesktop -bool true defaults write com.apple.finder FXICloudDriveDocuments -bool true defaults write com.apple.finder FinderSpawnTab -bool true defaults write com.apple.finder FXArrangeGroupViewBy -string "Name" defaults write com.apple.finder NewWindowTarget -string "PfHm" defaults write com.apple.finder NewWindowTargetPath -string "file:///Users/szirom/" defaults write com.apple.finder SidebarDevicesSectionDisclosedState -bool true defaults write com.apple.finder SidebarPlacesSectionDisclosedState -bool true defaults write com.apple.finder SidebarShowingSignedIntoiCloud -bool true defaults write com.apple.finder SidebarShowingiCloudDesktop -bool true defaults write com.apple.finder SidebarTagsSctionDisclosedState -bool true defaults write com.apple.finder SidebariCloudDriveSectionDisclosedState -bool true defaults write com.apple.finder SidebarWidth -int 124 #################################### # Dock # #################################### # Set the icon size of Dock items (30px) defaults write com.apple.dock tilesize -int 30 defaults write com.apple.dock largesize -int 70 defaults write com.apple.dock magnification -bool true # Don't minimize windows into their applications icon defaults write com.apple.dock minimize-to-application -bool false # Show indicator lights for open applications in the Dock defaults write com.apple.dock show-process-indicators -bool true # Animate opening applications from the Dock defaults write com.apple.dock launchanim -bool true # Speed up Mission Control animations defaults write com.apple.dock expose-animation-duration -float 0.1 # Don’t group windows by application in Mission Control # (i.e. use the old Exposé behavior instead) defaults write com.apple.dock expose-group-by-app -bool false # Don’t show Dashboard as a Space defaults write com.apple.dock dashboard-in-overlay -bool true # Remove the auto-hiding Dock delay defaults write com.apple.dock autohide-delay -float 0 # Remove the animation when hiding/showing the Dock defaults write com.apple.dock autohide-time-modifier -float 0 # Automatically hide and show the Dock defaults write com.apple.dock autohide -bool true # Hot corners # Possible values: # 0: no-op # 2: Mission Control # 3: Show application windows # 4: Desktop # 5: Start screen saver # 6: Disable screen saver # 7: Dashboard # 10: Put display to sleep # 11: Launchpad # 12: Notification Center # # Top left screen corner defaults write com.apple.dock wvous-tl-corner -int 0 defaults write com.apple.dock wvous-tl-modifier -int 0 # Top right screen corner defaults write com.apple.dock wvous-tr-corner -int 0 defaults write com.apple.dock wvous-tr-modifier -int 0 # Bottom left screen corner defaults write com.apple.dock wvous-bl-corner -int 0 defaults write com.apple.dock wvous-bl-modifier -int 0 # Bottom right screen corner defaults write com.apple.dock wvous-bl-corner -int 2 defaults write com.apple.dock wvous-bl-modifier -int 0 # Change indexing order and disable some search results # Yosemite-specific search results (remove them if you are using macOS 10.9 or older): # MENU_DEFINITION # MENU_CONVERSION # MENU_EXPRESSION # MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple) # MENU_WEBSEARCH (send search queries to Apple) # MENU_OTHER defaults write com.apple.spotlight orderedItems -array \ '{"enabled" = 1;"name" = "APPLICATIONS";}' \ '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \ '{"enabled" = 0;"name" = "DIRECTORIES";}' \ '{"enabled" = 0;"name" = "PDF";}' \ '{"enabled" = 0;"name" = "FONTS";}' \ '{"enabled" = 0;"name" = "DOCUMENTS";}' \ '{"enabled" = 0;"name" = "MESSAGES";}' \ '{"enabled" = 1;"name" = "CONTACT";}' \ '{"enabled" = 1;"name" = "EVENT_TODO";}' \ '{"enabled" = 0;"name" = "IMAGES";}' \ '{"enabled" = 1;"name" = "BOOKMARKS";}' \ '{"enabled" = 0;"name" = "MUSIC";}' \ '{"enabled" = 0;"name" = "MOVIES";}' \ '{"enabled" = 0;"name" = "PRESENTATIONS";}' \ '{"enabled" = 0;"name" = "SPREADSHEETS";}' \ '{"enabled" = 0;"name" = "SOURCE";}' \ '{"enabled" = 1;"name" = "MENU_DEFINITION";}' \ '{"enabled" = 0;"name" = "MENU_OTHER";}' \ '{"enabled" = 1;"name" = "MENU_CONVERSION";}' \ '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \ '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \ '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}' # Load new settings before rebuilding the index killall mds > /dev/null 2>&1 # Make sure indexing is enabled for the main volume sudo mdutil -i on / > /dev/null # Rebuild the index from scratch sudo mdutil -E / > /dev/null ############################################################################### # Kill affected applications # ############################################################################### for app in "Activity Monitor" \ "cfprefsd" \ "Dock" \ "Finder" \ "Google Chrome" \ "Messages" \ "SystemUIServer"; do killall "${app}" &> /dev/null done echo "Bootstrapping complete"