Skip to content

Instantly share code, notes, and snippets.

@snarbin
Forked from codeinthehole/osx_bootstrap.sh
Last active April 5, 2019 06:17
Show Gist options
  • Save snarbin/42f87b6586626c74fbe339c86ce93a8e to your computer and use it in GitHub Desktop.
Save snarbin/42f87b6586626c74fbe339c86ce93a8e to your computer and use it in GitHub Desktop.

Revisions

  1. snarbin revised this gist Sep 6, 2018. 1 changed file with 46 additions and 11 deletions.
    57 changes: 46 additions & 11 deletions osx_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -40,13 +40,11 @@ fi
    brew update

    # Install GNU core utilities (those that come with OS X are outdated)
    brew tap homebrew/dupes
    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
    @@ -55,8 +53,6 @@ brew install findutils
    brew install bash

    PACKAGES=(
    awscli
    apache-spark
    gdal
    git
    gradle
    @@ -67,6 +63,7 @@ PACKAGES=(
    pipenv
    python@2
    python3
    awscli
    [email protected] # need additional command to make this the default if installing multiple versions
    scala
    wget
    @@ -80,20 +77,20 @@ echo "Cleaning up..."
    brew cleanup

    echo "Installing cask..."
    brew install caskroom/cask/brew-cask
    #brew install caskroom/cask/brew-cask
    brew tap homebrew/cask-versions

    # Need to update so it doesn't fail if apps are already installed (like firefox was)
    CASKS=(
    adobe-acrobat-reader
    appcleaner
    atom
    chronosync
    dbvisualizer
    docker
    filezilla
    firefox
    google-chrome
    intellij-idea-ce
    java8
    postman
    pycharm-ce
    spotify
    @@ -104,8 +101,8 @@ CASKS=(
    echo "Installing cask apps..."
    brew cask install ${CASKS[@]}

    echo "Installing fonts..."
    brew tap caskroom/fonts
    # Needs java8 installed first
    brew install apache-spark

    echo "Installing Python packages..."
    PYTHON_PACKAGES=(
    @@ -126,7 +123,7 @@ echo "Configuring OSX..."
    osascript -e 'tell application "System Preferences" to quit'

    # Create symlink for OneDrive without spaces
    ln -s ${HOME}/OneDrive\ -\ HERE\ Global\ B.V /onedrive
    sudo ln -s ${HOME}/OneDrive\ -\ HERE\ Global\ B.V /onedrive

    # Require password 5 seconds after screensaver or sleep mode starts
    # defaults write com.apple.screensaver askForPassword -int 1
    @@ -258,6 +255,12 @@ defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightC
    defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
    defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true

    # Magic Mouse right-click
    defaults write com.apple.driver.AppleBluetoothMultitouch.mouse MouseButtonMode TwoButton

    # Magic Mouse swipe beteern pages


    ########
    # Sounds
    ########
    @@ -266,6 +269,7 @@ defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryCli
    sudo nvram SystemAudioVolume=" "

    # Disable chime when plugging mac into power
    defaults write com.apple.PowerChime ChimeOnNoHardware -bool true
    defaults write com.apple.PowerChime ChimeOnAllHardware -bool false; killall PowerChime

    # Disbale sound effects
    @@ -324,7 +328,7 @@ tell application "Terminal"
    local allOpenedWindows
    local initialOpenedWindows
    local windowID
    set themeName to "Ocean xterm-256color"
    set themeName to "Ocean"
    (* Store the IDs of all the open terminal windows. *)
    set initialOpenedWindows to id of every window
    (* Open the custom theme so that it gets added to the list
    @@ -404,6 +408,37 @@ defaults write com.apple.commerce AutoUpdate -bool true
    defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true


    # General
    # Recent items - change to 15
    defaults write -g NSNavRecentPlacesLimit -int 15 && \

    # Use dark menu bar and Dock

    # Automatically hide and show the menu bar

    ####
    # Security & Privacy
    ####

    # Allow your Apple Watch to unlock your Mac (must have signed in with iCloud account)

    # Privacy - let weather use location

    ####
    # Finder - additional setup
    ####

    # Add 'Applications' folder stack to dock
    # Favorites added to left panel of finder
    # Show all connections in sidebar - Finder prefs

    ####
    # Display
    ####
    # Night Shift on



    #echo "Creating folder structure..."
    #[[ ! -d Wiki ]] && mkdir Wiki
    #[[ ! -d Workspace ]] && mkdir Workspace
  2. snarbin revised this gist Sep 6, 2018. 1 changed file with 82 additions and 90 deletions.
    172 changes: 82 additions & 90 deletions osx_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -7,7 +7,6 @@
    # Some apps don't have a cask and so still need to be installed by hand. These
    # include:
    #
    # - Java 8
    # - Xcode (for command line tools)
    # - bettersnaptool
    # - Microsoft Remote Desktop
    @@ -28,6 +27,9 @@

    echo "Start bootstrapping mac"

    # Ask for the administrator password upfront
    sudo -v

    # Check for Homebrew, install if we don't have it
    if test ! $(which brew); then
    echo "Installing homebrew..."
    @@ -53,21 +55,21 @@ brew install findutils
    brew install bash

    PACKAGES=(
    awscli
    apache-spark
    openssl
    gradle
    maven
    pipenv
    [email protected]
    wget
    groovy
    node
    scala
    gdal
    git
    python@2
    python3
    awscli
    apache-spark
    gdal
    git
    gradle
    groovy
    maven
    node
    openssl
    pipenv
    python@2
    python3
    [email protected] # need additional command to make this the default if installing multiple versions
    scala
    wget
    vim
    )

    @@ -79,28 +81,27 @@ brew cleanup

    echo "Installing cask..."
    brew install caskroom/cask/brew-cask
    brew tap homebrew/cask-versions

    CASKS=(
    adobe-acrobat-reader
    appcleaner
    atom
    chronosync
    dbvisualizer
    docker
    filezilla
    firefox
    google-chrome
    intellij-idea-ce
    java8
    pycharm-ce
    webstorm
    postman
    spotify
    the-unarchiver
    appcleaner
    atom
    chronosync
    dbvisualizer
    docker
    filezilla
    firefox
    google-chrome
    intellij-idea-ce
    postman
    pycharm-ce
    spotify
    the-unarchiver
    webstorm
    )

    echo "Installing cask apps..."
    brew tap homebrew/cask-versions
    brew cask install ${CASKS[@]}

    echo "Installing fonts..."
    @@ -118,53 +119,40 @@ sudo pip3 install ${PYTHON_PACKAGES[@]}
    echo "Installing global npm packages..."
    npm install marked -g



    echo "Configuring OSX..."

    # Close any open System Preferences panes, to prevent them from overriding
    # settings we’re about to change
    osascript -e 'tell application "System Preferences" to quit'

    # Ask for the administrator password upfront
    sudo -v

    # Create symlink for OneDrive without spaces
    ln -s ${HOME}/OneDrive\ -\ HERE\ Global\ B.V /onedrive

    # Set fast key repeat rate
    #defaults write NSGlobalDomain KeyRepeat -int 0

    # Require password as soon as screensaver or sleep mode starts
    # Require password 5 seconds after screensaver or sleep mode starts
    # defaults write com.apple.screensaver askForPassword -int 1
    # defaults write com.apple.screensaver askForPasswordDelay -int 0

    # Finder: show hidden files by default
    defaults write com.apple.finder AppleShowAllFiles -bool true
    defaults write com.apple.screensaver askForPasswordDelay -int 1

    # Finder: show status bar
    defaults write com.apple.finder ShowStatusBar -bool true

    # Finder: show path bar
    defaults write com.apple.finder ShowPathbar -bool true

    # Finder: show hidden files by default
    defaults write com.apple.finder AppleShowAllFiles -bool true

    # Finder > Preferences > Show all filename extensions
    defaults write NSGlobalDomain AppleShowAllExtensions -bool true

    # Finder > Preferences > Show wraning before changing an extension
    # Finder > Preferences > Show warning before changing an extension
    defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

    # Finder > Preferences > Show wraning before removing from iCloud Drive
    # Finder > Preferences > Show warning before removing from iCloud Drive
    defaults write com.apple.finder FXEnableRemoveFromICloudDriveWarning -bool false

    # Finder > View > As List
    defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"


    # Add a stack with recent applications
    defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && \
    killall Dock

    # Keep folders on top when sorting by name
    defaults write com.apple.finder _FXSortFoldersFirst -bool true

    @@ -181,12 +169,30 @@ defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
    # Show the ~/Library folder
    chflags nohidden ~/Library

    # Set ~/projects as the default location for new Finder windows
    # For other paths, use `PfLo` and `file:///full/path/here/`
    defaults write com.apple.finder NewWindowTarget -string "PfLo"
    defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/projects/"

    # 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

    ################
    # Keyboard
    # All controls
    defaults write NSGlobalDomain AppleKeyboardUIMode -int 3
    ################

    # All controls - tab moves selection to use with spacebar
    defaults write NSGlobalDomain AppleKeyboardUIMode -int 3

    ################
    # Dock
    ################

    # Add a stack with recent applications
    defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && \

    # System Preferences > Dock > Minimize windows using: Scale effect
    defaults write com.apple.dock mineffect -string "scale"
    @@ -205,28 +211,12 @@ defaults write com.apple.dock show-process-indicators -bool true

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

    # System Preferences > Mission Controll > Automatically rearrange Spaces based on most recent use
    # System Preferences > Mission Control > Automatically rearrange Spaces based on most recent use
    defaults write com.apple.dock mru-spaces -bool false

    # System Preferences > Mission Controll > Dashboard
    # System Preferences > Mission Control > Dashboard
    defaults write com.apple.dock dashboard-in-overlay -bool false

    # Enable tap-to-click
    defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
    defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1

    # Disable the sound effects on boot
    sudo nvram SystemAudioVolume=" "

    # Disable chime when plugging mac into power
    defaults write com.apple.PowerChime ChimeOnAllHardware -bool false; killall PowerChime

    # Disbale sound effects
    defaults write com.apple.systemsound "com.apple.sound.uiaudio.enabled" -int 0

    # Turn off mtmd local TimeMachine snapshots that take a lot of CPU, not available in High sierra
    # sudo tmutil disablelocal

    # Disable transparency in the menu bar and elsewhere on Yosemite
    defaults write com.apple.universalaccess reduceTransparency -bool true

    @@ -253,6 +243,10 @@ defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false
    # Disable auto-correct
    defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false

    ####
    # Trackpad
    ####

    # 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
    @@ -264,19 +258,18 @@ defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightC
    defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1
    defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true

    # Increase sound quality for Bluetooth headphones/headsets
    defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
    ########
    # Sounds
    ########

    # Set default location for new Finder windows
    # For other paths, use `PfLo` and `file:///full/path/here/`
    defaults write com.apple.finder NewWindowTarget -string "PfLo"
    defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/projects/"
    # Disable the sound effects on boot
    sudo nvram SystemAudioVolume=" "

    # 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
    # Disable chime when plugging mac into power
    defaults write com.apple.PowerChime ChimeOnAllHardware -bool false; killall PowerChime

    # Disbale sound effects
    defaults write com.apple.systemsound "com.apple.sound.uiaudio.enabled" -int 0

    # Hot corners
    # Possible values:
    @@ -300,6 +293,10 @@ defaults write com.apple.dock wvous-tl-modifier -int 0
    #defaults write com.apple.dock wvous-bl-corner -int 5
    #defaults write com.apple.dock wvous-bl-modifier -int 0

    ########
    # Safari
    ########

    # Show the full URL in the address bar (note: this still hides the scheme)
    defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true

    @@ -308,15 +305,14 @@ 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


    # Enable “Do Not Track”
    defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true

    # Update extensions automatically
    defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true

    ###############################################################################
    # Terminal & iTerm 2 #
    # Terminal #
    ###############################################################################

    # Only use UTF-8 in Terminal.app
    @@ -328,7 +324,7 @@ tell application "Terminal"
    local allOpenedWindows
    local initialOpenedWindows
    local windowID
    set themeName to "Solarized Dark xterm-256color"
    set themeName to "Ocean xterm-256color"
    (* Store the IDs of all the open terminal windows. *)
    set initialOpenedWindows to id of every window
    (* Open the custom theme so that it gets added to the list
    @@ -408,10 +404,6 @@ defaults write com.apple.commerce AutoUpdate -bool true
    defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true



    # Disable "natural" scroll
    # defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

    #echo "Creating folder structure..."
    #[[ ! -d Wiki ]] && mkdir Wiki
    #[[ ! -d Workspace ]] && mkdir Workspace
  3. snarbin revised this gist Sep 6, 2018. 1 changed file with 27 additions and 3 deletions.
    30 changes: 27 additions & 3 deletions osx_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -91,6 +91,7 @@ filezilla
    firefox
    google-chrome
    intellij-idea-ce
    java8
    pycharm-ce
    webstorm
    postman
    @@ -99,6 +100,7 @@ the-unarchiver
    )

    echo "Installing cask apps..."
    brew tap homebrew/cask-versions
    brew cask install ${CASKS[@]}

    echo "Installing fonts..."
    @@ -127,6 +129,9 @@ osascript -e 'tell application "System Preferences" to quit'
    # Ask for the administrator password upfront
    sudo -v

    # Create symlink for OneDrive without spaces
    ln -s ${HOME}/OneDrive\ -\ HERE\ Global\ B.V /onedrive

    # Set fast key repeat rate
    #defaults write NSGlobalDomain KeyRepeat -int 0

    @@ -156,6 +161,10 @@ defaults write com.apple.finder FXEnableRemoveFromICloudDriveWarning -bool false
    defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"


    # Add a stack with recent applications
    defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && \
    killall Dock

    # Keep folders on top when sorting by name
    defaults write com.apple.finder _FXSortFoldersFirst -bool true

    @@ -172,6 +181,12 @@ defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true
    # Show the ~/Library folder
    chflags nohidden ~/Library

    # Keyboard
    # All controls
    defaults write NSGlobalDomain AppleKeyboardUIMode -int 3




    # System Preferences > Dock > Minimize windows using: Scale effect
    defaults write com.apple.dock mineffect -string "scale"
    @@ -203,6 +218,15 @@ defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
    # Disable the sound effects on boot
    sudo nvram SystemAudioVolume=" "

    # Disable chime when plugging mac into power
    defaults write com.apple.PowerChime ChimeOnAllHardware -bool false; killall PowerChime

    # Disbale sound effects
    defaults write com.apple.systemsound "com.apple.sound.uiaudio.enabled" -int 0

    # Turn off mtmd local TimeMachine snapshots that take a lot of CPU, not available in High sierra
    # sudo tmutil disablelocal

    # Disable transparency in the menu bar and elsewhere on Yosemite
    defaults write com.apple.universalaccess reduceTransparency -bool true

    @@ -243,10 +267,10 @@ defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryCli
    # Increase sound quality for Bluetooth headphones/headsets
    defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40

    # Set Desktop as the default location for new Finder windows
    # Set default location for new Finder windows
    # For other paths, use `PfLo` and `file:///full/path/here/`
    defaults write com.apple.finder NewWindowTarget -string "PfDe"
    defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/Desktop/"
    defaults write com.apple.finder NewWindowTarget -string "PfLo"
    defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/projects/"

    # Show icons for hard drives, servers, and removable media on the desktop
    defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
  4. snarbin revised this gist Sep 6, 2018. 1 changed file with 259 additions and 1 deletion.
    260 changes: 259 additions & 1 deletion osx_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -116,27 +116,285 @@ sudo pip3 install ${PYTHON_PACKAGES[@]}
    echo "Installing global npm packages..."
    npm install marked -g



    echo "Configuring OSX..."

    # Close any open System Preferences panes, to prevent them from overriding
    # settings we’re about to change
    osascript -e 'tell application "System Preferences" to quit'

    # Ask for the administrator password upfront
    sudo -v

    # Set fast key repeat rate
    #defaults write NSGlobalDomain KeyRepeat -int 0

    # Require password as soon as screensaver or sleep mode starts
    # defaults write com.apple.screensaver askForPassword -int 1
    # defaults write com.apple.screensaver askForPasswordDelay -int 0

    # Show filename extensions by default
    # Finder: show hidden files by default
    defaults write com.apple.finder AppleShowAllFiles -bool true

    # Finder: show status bar
    defaults write com.apple.finder ShowStatusBar -bool true

    # Finder: show path bar
    defaults write com.apple.finder ShowPathbar -bool true

    # Finder > Preferences > Show all filename extensions
    defaults write NSGlobalDomain AppleShowAllExtensions -bool true

    # Finder > Preferences > Show wraning before changing an extension
    defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

    # Finder > Preferences > Show wraning before removing from iCloud Drive
    defaults write com.apple.finder FXEnableRemoveFromICloudDriveWarning -bool false

    # Finder > View > As List
    defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"


    # Keep folders on top when sorting by name
    defaults write com.apple.finder _FXSortFoldersFirst -bool true

    # When performing a search, search the current folder by default
    defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"

    # 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

    # Enable AirDrop over Ethernet and on unsupported Macs running Lion
    defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true

    # Show the ~/Library folder
    chflags nohidden ~/Library


    # System Preferences > Dock > Minimize windows using: Scale effect
    defaults write com.apple.dock mineffect -string "scale"

    # System Preferences > Dock > Automatically hide and show the Dock:
    defaults write com.apple.dock autohide -bool true

    # System Preferences > Dock > Automatically hide and show the Dock (duration)
    defaults write com.apple.dock autohide-time-modifier -float 0.5

    # System Preferences > Dock > Automatically hide and show the Dock (delay)
    defaults write com.apple.dock autohide-delay -float 0

    # System Preferences > Dock > Show indicators for open applications
    defaults write com.apple.dock show-process-indicators -bool true

    # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #

    # System Preferences > Mission Controll > Automatically rearrange Spaces based on most recent use
    defaults write com.apple.dock mru-spaces -bool false

    # System Preferences > Mission Controll > Dashboard
    defaults write com.apple.dock dashboard-in-overlay -bool false

    # Enable tap-to-click
    defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
    defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1

    # Disable the sound effects on boot
    sudo nvram SystemAudioVolume=" "

    # Disable transparency in the menu bar and elsewhere on Yosemite
    defaults write com.apple.universalaccess reduceTransparency -bool true

    # Expand save panel by default
    defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true
    defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true

    # Reveal IP address, hostname, OS version, etc. when clicking the clock
    # in the login window
    sudo defaults write /Library/Preferences/com.apple.loginwindow AdminHostInfo HostName

    # Disable automatic capitalization as it’s annoying when typing code
    defaults write NSGlobalDomain NSAutomaticCapitalizationEnabled -bool false

    # Disable smart dashes as they’re annoying when typing code
    defaults write NSGlobalDomain NSAutomaticDashSubstitutionEnabled -bool false

    # Disable automatic period substitution as it’s annoying when typing code
    defaults write NSGlobalDomain NSAutomaticPeriodSubstitutionEnabled -bool false

    # Disable smart quotes as they’re annoying when typing code
    defaults write NSGlobalDomain NSAutomaticQuoteSubstitutionEnabled -bool false

    # Disable auto-correct
    defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false

    # 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

    # 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

    # Increase sound quality for Bluetooth headphones/headsets
    defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40

    # Set Desktop as the default location for new Finder windows
    # For other paths, use `PfLo` and `file:///full/path/here/`
    defaults write com.apple.finder NewWindowTarget -string "PfDe"
    defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}/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

    # 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 → Mission Control
    defaults write com.apple.dock wvous-tl-corner -int 10
    defaults write com.apple.dock wvous-tl-modifier -int 0
    # Top right screen corner → Desktop
    #defaults write com.apple.dock wvous-tr-corner -int 4
    #defaults write com.apple.dock wvous-tr-modifier -int 0
    # Bottom left screen corner → Start screen saver
    #defaults write com.apple.dock wvous-bl-corner -int 5
    #defaults write com.apple.dock wvous-bl-modifier -int 0

    # Show the full URL in the address bar (note: this still hides the scheme)
    defaults write com.apple.Safari ShowFullURLInSmartSearchField -bool true

    # Enable the Develop menu and the Web Inspector in Safari
    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


    # Enable “Do Not Track”
    defaults write com.apple.Safari SendDoNotTrackHTTPHeader -bool true

    # Update extensions automatically
    defaults write com.apple.Safari InstallExtensionUpdatesAutomatically -bool true

    ###############################################################################
    # Terminal & iTerm 2 #
    ###############################################################################

    # Only use UTF-8 in Terminal.app
    defaults write com.apple.terminal StringEncodings -array 4

    # Use a modified version of the Solarized Dark theme by default in Terminal.app
    osascript <<EOD
    tell application "Terminal"
    local allOpenedWindows
    local initialOpenedWindows
    local windowID
    set themeName to "Solarized Dark xterm-256color"
    (* Store the IDs of all the open terminal windows. *)
    set initialOpenedWindows to id of every window
    (* Open the custom theme so that it gets added to the list
    of available terminal themes (note: this will open two
    additional terminal windows). *)
    do shell script "open '$HOME/init/" & themeName & ".terminal'"
    (* Wait a little bit to ensure that the custom theme is added. *)
    delay 1
    (* Set the custom theme as the default terminal theme. *)
    set default settings to settings set themeName
    (* Get the IDs of all the currently opened terminal windows. *)
    set allOpenedWindows to id of every window
    repeat with windowID in allOpenedWindows
    (* Close the additional windows that were opened in order
    to add the custom theme to the list of terminal themes. *)
    if initialOpenedWindows does not contain windowID then
    close (every window whose id is windowID)
    (* Change the theme for the initial opened terminal windows
    to remove the need to close them in order for the custom
    theme to be applied. *)
    else
    set current settings of tabs of (every window whose id is windowID) to settings set themeName
    end if
    end repeat
    end tell
    EOD

    ###############################################################################
    # Address Book, Dashboard, iCal, TextEdit, and Disk Utility #
    ###############################################################################

    # Enable the debug menu in Address Book
    defaults write com.apple.addressbook ABShowDebugMenu -bool true

    # Enable Dashboard dev mode (allows keeping widgets on the desktop)
    defaults write com.apple.dashboard devmode -bool true

    # Enable the debug menu in iCal (pre-10.8)
    defaults write com.apple.iCal IncludeDebugMenu -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

    # Enable Debug Menu in the Mac App Store
    defaults write com.apple.appstore ShowDebugMenu -bool true

    # Enable the automatic update check
    defaults write com.apple.SoftwareUpdate AutomaticCheckEnabled -bool true

    # Check for software updates daily, not just once per week
    defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

    # Download newly available updates in background
    defaults write com.apple.SoftwareUpdate AutomaticDownload -int 1

    # Install System data files & security updates
    defaults write com.apple.SoftwareUpdate CriticalUpdateInstall -int 1

    # Automatically download apps purchased on other Macs
    defaults write com.apple.SoftwareUpdate ConfigDataInstall -int 1

    # Turn on app auto-update
    defaults write com.apple.commerce AutoUpdate -bool true

    ###############################################################################
    # Photos #
    ###############################################################################

    # Prevent Photos from opening automatically when devices are plugged in
    defaults -currentHost write com.apple.ImageCapture disableHotPlug -bool true



    # Disable "natural" scroll
    # defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

    #echo "Creating folder structure..."
    #[[ ! -d Wiki ]] && mkdir Wiki
    #[[ ! -d Workspace ]] && mkdir Workspace

    # Kill affected apps
    for app in "Dock" "Finder"; do
    killall "${app}" > /dev/null 2>&1
    done

    echo "Bootstrapping complete"
  5. snarbin revised this gist Sep 6, 2018. 1 changed file with 48 additions and 75 deletions.
    123 changes: 48 additions & 75 deletions osx_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -7,8 +7,11 @@
    # Some apps don't have a cask and so still need to be installed by hand. These
    # include:
    #
    # - Twitter (app store)
    # - Postgres.app (http://postgresapp.com/)
    # - Java 8
    # - Xcode (for command line tools)
    # - bettersnaptool
    # - Microsoft Remote Desktop
    # - QGIS
    #
    # Notes:
    #
    @@ -23,12 +26,12 @@
    # - https://news.ycombinator.com/item?id=8402079
    # - http://notes.jerzygangi.com/the-best-pgp-tutorial-for-mac-os-x-ever/

    echo "Starting bootstrapping"
    echo "Start bootstrapping mac"

    # 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)"
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    fi

    # Update homebrew recipes
    @@ -50,39 +53,22 @@ brew install findutils
    brew install bash

    PACKAGES=(
    ack
    autoconf
    automake
    boot2docker
    ffmpeg
    gettext
    gifsicle
    git
    graphviz
    hub
    imagemagick
    jq
    libjpeg
    libmemcached
    lynx
    markdown
    memcached
    mercurial
    npm
    pkg-config
    postgresql
    python
    python3
    pypy
    rabbitmq
    rename
    ssh-copy-id
    terminal-notifier
    the_silver_searcher
    tmux
    tree
    awscli
    apache-spark
    openssl
    gradle
    maven
    pipenv
    [email protected]
    wget
    groovy
    node
    scala
    gdal
    git
    python@2
    python3
    vim
    wget
    )

    echo "Installing packages..."
    @@ -95,62 +81,49 @@ echo "Installing cask..."
    brew install caskroom/cask/brew-cask

    CASKS=(
    colluquy
    dropbox
    firefox
    flux
    google-chrome
    google-drive
    gpgtools
    iterm2
    macvim
    skype
    slack
    spectacle
    vagrant
    virtualbox
    vlc
    adobe-acrobat-reader
    appcleaner
    atom
    chronosync
    dbvisualizer
    docker
    filezilla
    firefox
    google-chrome
    intellij-idea-ce
    pycharm-ce
    webstorm
    postman
    spotify
    the-unarchiver
    )

    echo "Installing cask apps..."
    brew cask install ${CASKS[@]}

    echo "Installing fonts..."
    brew tap caskroom/fonts
    FONTS=(
    font-inconsolidata
    font-roboto
    font-clear-sans
    )
    brew cask install ${FONTS[@]}

    echo "Installing Python packages..."
    PYTHON_PACKAGES=(
    ipython
    aws-sam-cli
    psycopg2
    setuptools
    virtualenv
    virtualenvwrapper
    )
    sudo pip install ${PYTHON_PACKAGES[@]}

    echo "Installing Ruby gems"
    RUBY_GEMS=(
    bundler
    filewatcher
    cocoapods
    )
    sudo gem install ${RUBY_GEMS[@]}
    sudo pip3 install ${PYTHON_PACKAGES[@]}

    echo "Installing global npm packages..."
    npm install marked -g

    echo "Configuring OSX..."

    # Set fast key repeat rate
    defaults write NSGlobalDomain KeyRepeat -int 0
    #defaults write NSGlobalDomain KeyRepeat -int 0

    # Require password as soon as screensaver or sleep mode starts
    defaults write com.apple.screensaver askForPassword -int 1
    defaults write com.apple.screensaver askForPasswordDelay -int 0
    # defaults write com.apple.screensaver askForPassword -int 1
    # defaults write com.apple.screensaver askForPasswordDelay -int 0

    # Show filename extensions by default
    defaults write NSGlobalDomain AppleShowAllExtensions -bool true
    @@ -160,10 +133,10 @@ defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool
    defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1

    # Disable "natural" scroll
    defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
    # defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

    echo "Creating folder structure..."
    [[ ! -d Wiki ]] && mkdir Wiki
    [[ ! -d Workspace ]] && mkdir Workspace
    #echo "Creating folder structure..."
    #[[ ! -d Wiki ]] && mkdir Wiki
    #[[ ! -d Workspace ]] && mkdir Workspace

    echo "Bootstrapping complete"
  6. @codeinthehole codeinthehole created this gist Mar 30, 2015.
    169 changes: 169 additions & 0 deletions osx_bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,169 @@
    #!/usr/bin/env bash
    #
    # Bootstrap script for setting up a new OSX machine
    #
    # This should be idempotent so it can be run multiple times.
    #
    # Some apps don't have a cask and so still need to be installed by hand. These
    # include:
    #
    # - Twitter (app store)
    # - Postgres.app (http://postgresapp.com/)
    #
    # Notes:
    #
    # - If installing full Xcode, it's better to install that first from the app
    # store before running the bootstrap script. Otherwise, Homebrew can't access
    # the Xcode libraries as the agreement hasn't been accepted yet.
    #
    # Reading:
    #
    # - http://lapwinglabs.com/blog/hacker-guide-to-setting-up-your-mac
    # - https://gist.github.com/MatthewMueller/e22d9840f9ea2fee4716
    # - https://news.ycombinator.com/item?id=8402079
    # - http://notes.jerzygangi.com/the-best-pgp-tutorial-for-mac-os-x-ever/

    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

    # Update homebrew recipes
    brew update

    # Install GNU core utilities (those that come with OS X are outdated)
    brew tap homebrew/dupes
    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=(
    ack
    autoconf
    automake
    boot2docker
    ffmpeg
    gettext
    gifsicle
    git
    graphviz
    hub
    imagemagick
    jq
    libjpeg
    libmemcached
    lynx
    markdown
    memcached
    mercurial
    npm
    pkg-config
    postgresql
    python
    python3
    pypy
    rabbitmq
    rename
    ssh-copy-id
    terminal-notifier
    the_silver_searcher
    tmux
    tree
    vim
    wget
    )

    echo "Installing packages..."
    brew install ${PACKAGES[@]}

    echo "Cleaning up..."
    brew cleanup

    echo "Installing cask..."
    brew install caskroom/cask/brew-cask

    CASKS=(
    colluquy
    dropbox
    firefox
    flux
    google-chrome
    google-drive
    gpgtools
    iterm2
    macvim
    skype
    slack
    spectacle
    vagrant
    virtualbox
    vlc
    )

    echo "Installing cask apps..."
    brew cask install ${CASKS[@]}

    echo "Installing fonts..."
    brew tap caskroom/fonts
    FONTS=(
    font-inconsolidata
    font-roboto
    font-clear-sans
    )
    brew cask install ${FONTS[@]}

    echo "Installing Python packages..."
    PYTHON_PACKAGES=(
    ipython
    virtualenv
    virtualenvwrapper
    )
    sudo pip install ${PYTHON_PACKAGES[@]}

    echo "Installing Ruby gems"
    RUBY_GEMS=(
    bundler
    filewatcher
    cocoapods
    )
    sudo gem install ${RUBY_GEMS[@]}

    echo "Installing global npm packages..."
    npm install marked -g

    echo "Configuring OSX..."

    # Set fast key repeat rate
    defaults write NSGlobalDomain KeyRepeat -int 0

    # Require password as soon as screensaver or sleep mode starts
    defaults write com.apple.screensaver askForPassword -int 1
    defaults write com.apple.screensaver askForPasswordDelay -int 0

    # Show filename extensions by default
    defaults write NSGlobalDomain AppleShowAllExtensions -bool true

    # Enable tap-to-click
    defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
    defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1

    # Disable "natural" scroll
    defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false

    echo "Creating folder structure..."
    [[ ! -d Wiki ]] && mkdir Wiki
    [[ ! -d Workspace ]] && mkdir Workspace

    echo "Bootstrapping complete"