Skip to content
Snippets Groups Projects
04_defaultsettings.command 10.3 KiB
Newer Older
#######################################################################################
# Dieses Script dient dazu ein paar "Standardeinstellungen" zu vereinfachen.
# Die jeweiligen Erklärungen der einzelnen Abschnitte steht über den jeweiligen Befehl!
#######################################################################################

osascript -e 'tell application "System Preferences" to quit'
# Frage sofort nach dem Adminpasswort
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 &

################################################################################
 # Software Updates                                                            #
 ###############################################################################

 # 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 -bool true

 # Download newly available updates in background
 defaults write com.apple.SoftwareUpdate AutomaticDownload -bool true

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

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

 # Allow the App Store to reboot machine on macOS updates
 defaults write com.apple.commerce AutoUpdateRestartRequired -bool true

################################################################################
 # General UI/UX                                                               #
 ###############################################################################
 # Kopieren des Firefox Profiles und Connect Commands #
 BASEDIR=$(dirname "$0")
 file1=$(echo "$BASEDIR"/Netzwerklaufwerke/connect_*)
 FF_Profile=$(echo "$BASEDIR"/Firefox)
 cp $file1 /Users/Shared/
 mv /Users/Shared/connect_edv.command /Users/$USER/Desktop/
 echo "Kopiere Firefox Ordner"
 cp -R $FF_Profile ~/Library/Application\ Support/

 # Set language and text formats
 defaults write NSGlobalDomain AppleLanguages -array "de" "DE"
 defaults write NSGlobalDomain AppleLocale -string "de_DE@currency=EUR"
 defaults write NSGlobalDomain AppleMeasurementUnits -string "Centimeters"
 defaults write NSGlobalDomain AppleMetricUnits -bool true

 # Set the timezone (see `sudo systemsetup -listtimezones` for other values)
 sudo systemsetup -settimezone "Europe/Berlin" > /dev/null

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

 # Automatically quit printer app once the print jobs complete
 defaults write com.apple.print.PrintingPrefs "Quit When Finished" -bool true

 # Disable the “Are you sure you want to open this application?” dialog
 defaults write com.apple.LaunchServices LSQuarantine -bool false

 # Expand print panel by default
 defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true
 defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true

 # 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

 # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
 defaults write com.apple.screencapture type -string "png"

 # Disable shadow in screenshots
 defaults write com.apple.screencapture disable-shadow -bool true

###############################################################################
 # FINDER SETTINGS #
 ##############################################################################
 # Use list 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 "Nlsv"

 # Sorgt dafür das das die "Pathbar" immer angezeigt wird (klappt erst nach neustart!)
 defaults write com.apple.finder ShowPathbar -bool YES

 # Statusbar einblenben
 defaults write com.apple.finder ShowStatusBar -bool true

 # (Externe) Festplatten und Server auf dem Desktop anzeigen lassen
 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 battery percentage
 defaults write com.apple.menuextra.battery ShowPercent -string "YES"

 # Avoid creating .DS_Store files on network volumes AND USB Volumes
 defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
 defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true

 # Empty Trash securely by default
 defaults write com.apple.finder EmptyTrashSecurely -bool true

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

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

 # Prevent iTunes from opening automatically when devices are plugged in
 defaults write com.apple.iTunesHelper ignore-devices 1

 # Save to disk by default - not to iCloud
 defaults write NSGlobalDomain NSDocumentSaveNewDocumentsToCloud -bool false

 # Prevent Time Machine from prompting to use new hard drives as backup volume
 defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true

###############################################################################
 # Dock & hot corners                                                         #
 ##############################################################################

# Enable highlight hover effect for the grid view of a stack (Dock)
 defaults write com.apple.dock mouse-over-hilte-stack -bool true
# Set the icon size of Dock items to 36 pixels
# Enable spring loading for all Dock items
 defaults write com.apple.dock enable-spring-load-actions-on-all-items -bool true
# Show indicator lights for open applications in the Dock
 defaults write com.apple.dock show-process-indicators -bool true
# Speed up Mission Control animations
 defaults write com.apple.dock expose-animation-duration -float 0.1
# 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
# Make Dock icons of hidden applications translucent
 defaults write com.apple.dock showhidden -bool true
 # Wipe all (default) app icons from the Dock
 defaults write com.apple.dock persistent-apps -array
 # Minimise windows into application icon
 defaults write com.apple.dock minimize-to-application -bool true
 # Automatically hide and show the Dock
 defaults write com.apple.dock autohide -bool true
 # Show recent applications in Dock
 defaults write com.apple.dock show-recents -bool false
# Add Apps - Requieres Dockutil
dockutil --no-restart --add "/Applications/Firefox.app/"
 killall Dock
# Hot corners
 # Top left screen corner -- Mission Control
 defaults write com.apple.dock wvous-tl-corner -int 2
 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
killall Finder

################################################################################
 # Terminal                                                                    #
 ###############################################################################

# Appearance
defaults write com.apple.terminal "Default Window Settings" -string "Pro"
defaults write com.apple.terminal "Startup Window Settings" -string "Pro"
defaults write com.apple.Terminal ShowLineMarks -int 0

###############################################################################
 # Textedit                                                                   #
 ##############################################################################
  # 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

###############################################################################
 # Hardware                                                                   #
 ##############################################################################
 # Bildschirm
  # Aktiviere subpixel font rendering on non-Apple LCDs
  defaults write NSGlobalDomain AppleFontSmoothing -int 2

 # Trackpad
  # Aktiviere tap to click for this user and for the login screen
  defaults write com.apple.AppleMultitouchTrackpad Clicking -bool true
  defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
  # Enable tap at login as well
  defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
  defaults write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
  # 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

 # Drucker
  # Erlaube allen Usern Drucker einzurichten
  echo "Setze Druckerberechtigungen"
  sudo /usr/bin/security authorizationdb write system.preferences.printing allow
  sudo /usr/bin/security authorizationdb write system.print.operator allow
  sudo /usr/sbin/dseditgroup -o edit -n /Local/Default -a everyone -t group lpadmin
  sudo /usr/sbin/dseditgroup -o edit -n /Local/Default -a everyone -t group _lpadmin

 # Tastatur
  # Turn off keyboard illumination when computer is not used for 5 minutes
   defaults write com.apple.BezelServices kDimTime -int 300