Last active
April 2, 2022 08:59
-
-
Save drazulay/918f80a98841cb4959c39e4a6c701ee6 to your computer and use it in GitHub Desktop.
OS X Developer onboarding 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
#! /usr/bin/env bash | |
################################ | |
# Onboarding script for OS X | |
# Installs a bunch of software, | |
# and optionally an extra bunch | |
# of other software - yay, more | |
# bytezz! Also does some config- | |
# foo like a small zsh and os x | |
# polish. | |
# | |
# Copy & tweak this file | |
################################ | |
[[ "$1" == "--extra" ]] && EXTRA=1 || EXTRA=0 | |
STEP="" | |
# I don't use the 'unofficial bash strict mode' but opt for using | |
# a trap function on ERR instead | |
set -o pipefail | |
function err_handler | |
{ | |
echo "Unexpected interruption at step '${STEP}', process exited with code: $?". | |
} | |
trap 'err_handler' ERR | |
echo -e "\nStarting..." | |
sudo -v | |
################################ | |
# Declare functions | |
################################ | |
function set_installer_step | |
{ | |
echo -e "\nExecuting step: ${1}..." | |
export STEP="${1}" | |
} | |
function add_bin_dirs_to_path | |
{ | |
local p | |
for ELEM in "$@"; do | |
export PATH="${ELEM}:${PATH}" | |
done | |
} | |
################################ | |
# Update required Apple software | |
################################ | |
set_installer_step "Apple: Software Update" | |
sudo -v | |
softwareupdate --all --install --force | |
################################ | |
# Install homebrew | |
################################ | |
set_installer_step "Install Homebrew" | |
sudo -v | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | |
################################ | |
## Install base set of software | |
################################ | |
set_installer_step "Brew: Install Basic Applications" | |
sudo -v | |
brew tap homebrew/cask | |
brew tap homebrew/cask-versions | |
brew tap henkrehorst/homebrew-php | |
brew update | |
brew upgrade | |
brew install $FORCE composer | |
brew install $FORCE eslint | |
brew install $FORCE --cask hex-fiend | |
brew install $FORCE --cask firefox-developer-edition | |
brew install $FORCE --cask iterm2 | |
brew install $FORCE --cask lulu | |
brew install $FORCE --cask macdown | |
brew install $FORCE --cask microsoft-teams | |
brew install $FORCE node | |
brew install $FORCE npm | |
brew install $FORCE --cask phpstorm | |
brew install $FORCE --cask sequel-pro | |
brew install $FORCE tree | |
brew install $FORCE wget | |
brew install $FORCE --cask slack | |
brew install $FORCE yarn | |
brew install $FORCE zsh | |
# valet-php is problematic -- might even need to have it's formula edited to install 7.4.28 | |
# instead of failing 7.4.16 | |
sudo -v | |
brew install [email protected] | |
brew link [email protected] --force --overwrite | |
################################ | |
# grml.org zshrc's | |
################################ | |
set_installer_step "Zsh: install rc scripts from grml.org" | |
sudo -v | |
cd ~ | |
wget -O .zshrc.local https://git.grml.org/f/grml-etc-core/etc/skel/.zshrc | |
wget -O .zshrc https://git.grml.org/f/grml-etc-core/etc/zsh/zshrc | |
touch .zshrc.pre | |
################################ | |
## Path entries | |
################################ | |
set_installer_step "Shell: set \$PATH variable" | |
sudo -v | |
add_bin_dirs_to_path "${HOME}/.bin" \ | |
"/usr/local/sbin" \ | |
"/Users/daniel/.composer/vendor/bin" \ | |
"/Users/daniel/.cargo/bin" | |
echo "$PATH is now:" | |
echo $PATH | |
echo "This will be added to ~/.zshrc.pre" | |
echo "export PATH=\"${PATH}\"" >> .zshrc.pre | |
## Composer global requirements | |
set_installer_step "Composer: install global requirements" | |
sudo -v | |
composer global require weprovide/valet-plus | |
composer global require phpmd/phpmd | |
composer global require n98/magerun2-dist | |
################################ | |
# Set sane OS X defaults | |
################################ | |
set_installer_step "Apple: set OS X defaults" | |
sudo -v | |
defaults write NSGlobalDomain AppleShowScrollBars -string "Always" # Always show scrollbar | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true # Show full save panel by default | |
defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode2 -bool true | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true # Show full print panel by default | |
defaults write NSGlobalDomain PMPrintingExpandedStateForPrint2 -bool true | |
defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false # No more unnatural backwards scrolling | |
################################ | |
# Install extra apps if requested | |
################################ | |
if [[ "$EXTRA" == "1" ]]; then | |
set_installer_step "Homebrew: install extra applications" | |
sudo -v | |
brew install $FORCE --cask clion | |
brew install $FORCE --cask discord | |
brew install $FORCE --cask gimp | |
brew install $FORCE --cask keybase | |
brew install $FORCE --cask ledger-live | |
brew install $FORCE --cask protonmail-bridge | |
brew install $FORCE --cask protonvpn | |
brew install $FORCE --cask pycharm-ce | |
brew install $FORCE --cask qbittorrent | |
brew install $FORCE --cask rectangle | |
brew install $FORCE rustup-init | |
brew install $FORCE --cask signal | |
brew install $FORCE --cask skype | |
brew install $FORCE --cask spotify | |
brew install $FORCE --cask telegram-desktop | |
set_installer_step "Yubico: install yubikey-manager" | |
mkdir -p /tmp/drazulay/software | |
cd /tmp/drazulay/software | |
# yubico | |
sudo -v | |
wget "https://developers.yubico.com/yubikey-manager-qt/Releases/yubikey-manager-qt-latest-mac.pkg" "yubikey-manager-qt-latest-mac.pkg" | |
sudo installer -pkg yubikey-manager-qt-latest-mac.pkg -target / | |
fi | |
################################ | |
# Done, define trap & cleanup | |
################################ | |
brew cleanup | |
rm -rf /tmp/drazulay/software | |
echo -e "################################\n" | |
echo "Done." | |
echo "You should now have a workable system." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment