#!/usr/bin/env bash # Setup script for setting up a new macos machine echo "Starting setup" declare -A nonPckgApps nonPckgApps[PhraseExpress]="https://www.phraseexpress.com/de/mac/download/" nonPckgApps[AusweisApp2]="https://www.ausweisapp.bund.de/download/windows-und-mac/" #nonPckgApps[]="" BREWFILE="$1" LOGGER_BIN="/usr/bin/logger -ist '$0'" # Check for Homebrew to be present, install if it's missing if test ! $(which brew); then echo "Installing homebrew..." /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" fi BREW_BIN=$(which brew) BREW_PREFX=$(brew --prefix) CASK_DIR=$(brew --caskroom) # Update homebrew recipes $BREW_BIN update $BREW_BIN install mackup MACKUP_DIR="$HOME/Library/Mobile Documents/com~apple~CloudDocs/Mackup" ​ln -s $MACKUP_DIR/.mackup.cfg $HOME/.mackup.cfg MACKUP_BIN=$(which mackup) read -t 60 -n 1 -p "configure iCloud Drive and confirm to continue with Brewfile '$BREWFILE'? [y/N]: " answer if [ $? == 0 ]; then echo echo "allow Apps downloaded from anywhere…" sudo spctl --master-disable #open /System/Library/PreferencePanes/Security.prefPane echo echo "Make sure Rosetta is installed..." sudo softwareupdate --install-rosetta $BREW_BIN bundle --verbose --file="$BREWFILE" | $LOGGER_BIN $MACKUP_BIN restore #echo "this script is unable to install the following apps..." #for key val in ${(kv)nonPckgApps}; do # echo "$key" # open "$val" #done read -n 1 -p "Hit return to continue: " answer echo "these apps will need manual config and opened in the background..." find "$CASK_DIR" -iname "*.app" | while read APP; do open "$APP"; done read -n 1 -p "Hit return to continue: " answer echo "Configuring OS... (may need sudo)" MACOS = ".macos" source "$MACOS" # Pin The Dock To The Left(start), Bottom(middle), Right(end) defaults write com.apple.dock pinning -string middle # Set dock to a flat 2D version defaults write com.apple.dock no-glass -boolean YES && killall Dock; # Recent Applications Stack in Dock defaults write com.apple.dock persistent-others -array-add '{ "tile-data" = { "list-type" = 1; }; "tile-type" = "recents-tile"; }' && killall Dock; # put a small gradient behind an icon defaults write com.apple.dock mouse-over-hilte-stack -boolean YES && killall Dock; # add a message of your choice to the Login window sudo defaults write /Library/Preferences/com.apple.loginwindow LoginwindowText "Welcome back..." # Enable Time Machine On Unsupported Drives defaults write com.apple.systempreferences TMShowUnsupportedNetworkVolumes 1 # Force Mail To Display In Plain Text defaults write com.apple.mail PreferPlainText -bool TRUE # widegts on the dashboard defaults write com.apple.dashboard devmode YES echo "Macbook setup completed!" else echo "Can't wait anymore!" fi