-
-
Save ben-hampson/3fc919ce0a44c1f04a23efe54408cb8b to your computer and use it in GitHub Desktop.
Mac Setup Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
echo "Creating an SSH key for you..." | |
ssh-keygen -t ed25519 | |
cat $HOME/.ssh/id_ed25519.pub | |
echo "Please add this public key to Github \n" | |
echo "https://github.com/account/ssh \n" | |
read -p "Press [Enter] key after this..." | |
echo "Installing Xcode stuff" | |
xcode-select --install | |
if test ! $(which brew); then | |
echo "Installing homebrew..." | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
fi | |
echo "Updating homebrew..." | |
brew update | |
echo "Installing Git..." | |
brew install git | |
echo "Git config" | |
git config --global user.name "Ben Hampson" | |
git config --global user.email [email protected] | |
echo "Installing other brew stuff..." | |
brew install tree | |
brew install alfred | |
brew install --cask obsidian | |
brew install --cask 1password | |
brew install --cask visual-studio-code | |
brew install --cask moom | |
# Enable `code` command | |
echo 'export PATH="$PATH:/Applications/Visual Studio Code.app/Contents/Resources/app/bin"' >> ~/.zshrc | |
# Mac App Store CLI | |
brew install mas | |
# Use `mas list` or `mas search <name>` to get identifiers | |
mas install 1569813296 # 1Password for Safari | |
mas install 1365531024 # 1Blocker | |
echo "Mackup" | |
brew install mackup | |
echo "[storage]\nengine = icloud" > ~/.mackup.cfg | |
mackup restore | |
echo "Python setup" | |
brew install asdf | |
# This step can be replaced by the asdf plugin for oh-my-zsh | |
echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc | |
# Dependencies for Python plugin | |
brew install openssl readline sqlite3 xz zlib tcl-tk | |
asdf plugin-add python | |
asdf install python latest | |
asdf install python 3.7.15 3.9.15 3.10.8 | |
asdf global python 3.7.15 | |
brew install poetry | |
echo "Starship" | |
brew install starship | |
echo 'eval "$(starship init zsh)"' >> ~/.zshrc | |
echo "Fira Code Font" | |
brew tap homebrew/cask-fonts | |
brew install --cask font-fira-code | |
echo "Configuring Dock" | |
brew install dockutil | |
dockutil --remove all | |
dockutil --add /Applications/Safari.app | |
dockutil --add /Applications/Utilities/Terminal.app | |
dockutil --add /Applications/Obsidian.app | |
dockutil --add '~/Downloads' | |
brew uninstall dockutil | |
echo "Cleaning up brew" | |
brew cleanup | |
echo "Setting some Mac settings..." | |
# Allow text selection in Quick Look | |
defaults write com.apple.finder QLEnableTextSelection -bool TRUE | |
# Expanding the save panel by default | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true | |
# Check for software updates daily, not just once per week | |
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1 | |
# Disabling press-and-hold for keys in favor of a key repeat | |
defaults write NSGlobalDomain ApplePressAndHoldEnabled -bool false | |
# Setting trackpad & mouse speed to a reasonable number | |
defaults write -g com.apple.trackpad.scaling 2 | |
defaults write -g com.apple.mouse.scaling 2.5 | |
# Enabling subpixel font rendering on non-Apple LCDs | |
defaults write NSGlobalDomain AppleFontSmoothing -int 2 | |
# Disabling the warning when changing a file extension | |
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false | |
# Use column view in all Finder windows by default | |
defaults write com.apple.finder FXPreferredViewStyle Clmv | |
# Enabling snap-to-grid for icons on the desktop and in other icon views | |
/usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
/usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist | |
# Setting Dock to auto-hide and removing the auto-hiding delay | |
defaults write com.apple.dock autohide -bool true | |
defaults write com.apple.dock autohide-delay -float 0 | |
defaults write com.apple.dock autohide-time-modifier -float 0 | |
killall Finder | |
echo "Done!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment