setup/setup.sh
Phillip 80da53eac4 Update setup.sh
Copy the terminal profile instead of moving it.
2024-06-06 12:20:38 +00:00

101 lines
3.9 KiB
Bash
Executable File

#!/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"
defaults write -g com.apple.mouse.scaling 9
# 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)"
# 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
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
# Copy ZSH Profile
rsync zshrc ~/.zshrc
source ~/.zshrc
# Install LTS version of Node and the second most recent version of Python
# ToDo - programmatically set the Python version instead of directly specifying it
nvm install --lts
pyenv install 3.11
pyenv global 3.11
# Install imagemagic module for PHP
pecl install imagick
# Install Laravel Valet
composer global require laravel/valet
valet install
# Prompt user to reboot
echo "Setup complete, please reboot."