Last active
June 9, 2021 22:58
-
-
Save jimmygle/6a679671fe2aeb9e29555337c57c90d0 to your computer and use it in GitHub Desktop.
Helps automatically setup/configure new OSX box.
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 | |
# Setup script for setting up a new macos machine | |
# Stolen from: https://medium.com/macoclock/automating-your-macos-setup-with-homebrew-and-cask-e2a103b51af1 | |
echo "Starting setup" | |
# install xcode CLI | |
xcode-select --install | |
# Check for Homebrew to be present, install if it's missing | |
if test ! $(which brew); then | |
echo "Installing homebrew..." | |
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" | |
fi | |
# Update homebrew recipes | |
brew update | |
PACKAGES=( | |
git | |
tmux | |
bat | |
macvim | |
mysql | |
fzf | |
curl | |
exiftool | |
composer | |
youtube-dl | |
rbenv | |
coreutils | |
) | |
echo "Installing packages..." | |
brew install ${PACKAGES[@]} | |
echo "Installing cask..." | |
CASKS=( | |
iterm2 | |
slack | |
spotify | |
macdown | |
sublime-text | |
brave-browser | |
appcleaner | |
tableplus | |
virtualbox | |
emacs | |
postman | |
cyberduck | |
vlc | |
firefox | |
lastpass | |
visual-studio-code | |
) | |
echo "Installing cask apps..." | |
brew install ${CASKS[@]} | |
# | |
# Configure iTerm | |
# | |
echo "Configuring iTerm..." | |
# Install zsh | |
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" | |
# Install powerline10k | |
# https://gist.github.com/kevin-smets/8568070 | |
# TODO: Export saved config from p10k setup wizard | |
# Install iTerm shell integration | |
# https://iterm2.com/documentation-shell-integration.html | |
# Menu: iTerm2 > Install Shell Integration (needs to be automated) | |
# TODO: Export iTerm2 configuration | |
# Install external zsh plugins | |
# Colored man pages | |
# https://github.com/ael-code/zsh-colored-man-pages.git | |
git clone https://github.com/ael-code/zsh-colored-man-pages.git $ZSH_CUSTOM/plugins/colored-man-pages | |
# Automatically suggest/complete as typing | |
# https://github.com/marlonrichert/zsh-autocomplete | |
# DISABLED - it's too much, but provides really good suggestions | |
# git clone https://github.com/marlonrichert/zsh-autocomplete.git $ZSH_CUSTOM/plugins/zsh-autocomplete | |
# Automatically suggest completions | |
# https://github.com/zsh-users/zsh-autosuggestions | |
# Replacement for zsh-autocomplete | |
https://github.com/zsh-users/zsh-autosuggestions.git $ZSH_CUSTOM/plugins/zsh-autosuggestions | |
# Alias reminder | |
# https://github.com/MichaelAquilina/zsh-you-should-use | |
git clone https://github.com/MichaelAquilina/zsh-you-should-use.git $ZSH_CUSTOM/plugins/you-should-use | |
# Automatic syntax highlighting | |
# https://github.com/zsh-users/zsh-syntax-highlighting | |
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting | |
## | |
## Terminal aliases and functions | |
## | |
echo "Adding aliases, functions, and other junk to zsh" | |
# Sets up projects dir and aliases | |
mkdir -p ~/proj/ | |
cat <<'EOT' >> ~/.zshrc | |
# Creates dynamic project aliases | |
# 1. Creates alias for the ~/proj/ dir at `proj` | |
# 2. Dynamically creates aliases for each top level dir in ~/proj/ | |
function create_proj_aliases { | |
alias proj="pushd $1" | |
for dir in $1*/; do alias `basename $dir`="pushd $dir"; done | |
} | |
create_proj_aliases ~/proj/ | |
EOT | |
echo "Configuring OS..." | |
# Set fast key repeat rate | |
# NOTE: This doesn't work anymore (System Preferences -> Keyboard -> Key Repeat & Delay Until Repeat) | |
# sudo defaults write NSGlobalDomain KeyRepeat -int 0 | |
# Require password as soon as screensaver or sleep mode starts | |
# defaults write com.apple.screensaver askForPassword -int 1 | |
# defaults write com.apple.screensaver askForPasswordDelay -int 0 | |
# Show filename extensions by default | |
# defaults write NSGlobalDomain AppleShowAllExtensions -bool true | |
# Enable tap-to-click | |
# NOTE: This doesn't work anymore (System Preferences -> Trackpad -> Tap to Click) | |
# defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true | |
# defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1 | |
# Enable three finger drag/drop | |
# NOTE: This doesn't work anymore (System Preferences -> Accessibility -> Pointer Control -> Trackpad Options -> Enable Dragging) | |
# defaults -currentHost write NSGlobalDomain com.apple.trackpad.threeFingerSwipeGesture -int 1 | |
echo "Macbook setup completed!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment