Fix bugs and add checks for Xcode CLI and Homebrew

This commit is contained in:
Phillip 2024-09-20 23:58:28 +01:00
parent 7039236d53
commit f64b5b7229

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/zsh
echo "Configuring macOS System Settings (you may be asked to enter password)"
@ -57,18 +57,31 @@ 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)"
# Check if Xcode CLI Tools are installed, install them if not
if [[ $(xcode-select -p) == "" ]]; then
xcode-select --install
else
echo "Xcode CLI Tools are already installed"
fi
# Set git to save any credentials in the macOS Keychain
git config --global credential.helper osxkeychain
# Check if Homebrew is present, update if installed, run the install script if not
if [[ $(command -v brew) == "" ]]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
else
echo "Homebrew is already installed, running brew update"
brew update
fi
# 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
# Function to open up Terminal using the downloaded theme
setCustomTerminalTheme(){
cp Custom.terminal ~/Downloads/Custom.terminal
osascript <<EOD
tell application "Terminal"
@ -78,10 +91,18 @@ tell application "Terminal"
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
}
# Check if custom Terminal theme is already set and set up if not
if [[ $(defaults read com.apple.Terminal "Startup Window Settings") !== "Custom" ]]; then
setCustomTerminalTheme
echo "Custom Terminal theme is now the default"
else
echo "Custom Terminal theme is already set as default"
fi
#Copy ZSH Profile
rsync zshrc ~/.zshrc