setup/setup.sh

91 lines
3.7 KiB
Bash
Raw Normal View History

2024-05-23 16:39:59 +00:00
#!/bin/bash
echo "Configuring macOS System Settings (you may be asked to enter password)"
# Enable and configure firewall
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate on
sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setstealthmode on
# Set DNS servers
networksetup -setdnsservers Ethernet 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
networksetup -setdnsservers Wi-Fi 1.1.1.1 1.0.0.1 2606:4700:4700::1111 2606:4700:4700::1001
# Disable Handoff
defaults -currentHost write com.apple.coreservices.useractivityd ActivityAdvertisingAllowed -bool no
defaults -currentHost write com.apple.coreservices.useractivityd ActivityReceivingAllowed -bool no
# Configure the Dock
# Disable "Show recent applications in Dock"
defaults write com.apple.dock "show-recents" -bool FALSE
# Set "Minimise windows using" to "Scale Effect"
defaults write com.apple.dock mineffect scale
# Enable "Minimise windows into application icon"
defaults write com.apple.dock "minimize-to-application" -bool TRUE
# Set numbers of rows and columns in Launchpad
defaults write com.apple.dock springboard-columns -int 6;
defaults write com.apple.dock springboard-columns -int 6;
# Increase mouse speed beyond available options in System Settings
echo "Increase mouse speed"
2024-09-12 14:02:16 +00:00
defaults write -g com.apple.mouse.scaling 10
2024-05-23 16:39:59 +00:00
# Configure Finder
echo "Configuring Finder"
# Set list view as default
defaults write com.apple.finder FXPreferredViewStyle -string "Nlsv"
# Show the path and status bars (TODO: setting for tabs bar)
defaults write com.apple.finder ShowPathbar -bool true
defaults write com.apple.finder ShowStatusBar -bool true
# Sort files so directories appear above files
defaults write com.apple.finder _FXSortFoldersFirst -bool true
# Set the default search scope to be the current folder
defaults write com.apple.finder FXDefaultSearchScope -string "SCcf"
# Set default location for Finder to the home directory
defaults write com.apple.finder "NewWindowTarget" -string "PfHm"
defaults write com.apple.finder "NewWindowTargetPath" -string "file://${HOME}/"
# Create location for saving screenshots and set it as the default
# Also remove shadow effect macOS adds to window screenshots
echo "- Screenshots saved to ~/Pictures/Screenshots with shadow effects disabled"
mkdir -p ~/Pictures/Screenshots
defaults write com.apple.screencapture location -string "${HOME}/Pictures/Screenshots"
defaults write com.apple.screencapture disable-shadow -bool true
# Avoid creating .DS_Store files on network or USB volumes
# ToDo - Check if this actually works
echo "- Avoid creating .DS_Store files on external volumes"
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
defaults write com.apple.desktopservices DSDontWriteUSBStores -bool true
# Install Homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Set git to save any credentials in the macOS Keychain
git config --global credential.helper osxkeychain
2024-05-23 16:39:59 +00:00
# Run Homebrew bundle with specified file
brew bundle --file Brewfile
# Run bash script to reconfigure Dock
./Dock.sh
# Applescript to open up Terminal using the downloaded theme
cp Custom.terminal ~/Downloads/Custom.terminal
2024-05-23 16:39:59 +00:00
osascript <<EOD
tell application "Terminal"
activate
set TerminalThemeFile to (POSIX path of ((path to home folder) as text) & "/Downloads/Custom.terminal")
open TerminalThemeFile
delay 1
end tell
EOD
# Set theme to default
defaults write com.apple.Terminal "Startup Window Settings" -string "Custom"
defaults write com.apple.Terminal "Default Window Settings" -string "Custom"
rm ~/Downloads/Custom.terminal
2024-09-19 09:19:47 +00:00
#Copy ZSH Profile
2024-05-23 16:39:59 +00:00
rsync zshrc ~/.zshrc
source ~/.zshrc
# Prompt user to reboot
echo "Setup complete, please reboot."