Skip to content

Instantly share code, notes, and snippets.

@litwicki
Last active March 3, 2019 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save litwicki/23ed9628dbcac265b6c2226dfcbe781f to your computer and use it in GitHub Desktop.
Save litwicki/23ed9628dbcac265b6c2226dfcbe781f to your computer and use it in GitHub Desktop.
MAC Developer Setup
#!/usr/bin/env bash
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
# Install/verify Xcode Command Line Tools are setup
if xcode-select --version 2>&1 | grep version; then
echo "${green}Yay, you have installed XCode with Command Line Tools"
else
echo "${red}XCode with Command Line Tools not found, installing now.."
./xcode.sh
fi
echo "Moving to home directory to do some stuff!"
cd "$HOME"
which -s brew
if [[ $? != 0 ]] ; then
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
git -C "$(brew --repo homebrew/core)" fetch --unshallow
if type brew 2&>/dev/null; then
for completion_file in $(brew --prefix)/etc/bash_completion.d/*; do
source "$completion_file"
done
fi
else
brew update >/dev/null 2>&1
fi
(set -x; brew cleanup;)
# Install some useful Brew packages
PACKAGES=(
brew-cask-completion
findutils
bash
git
go
sqlite
tig
git-crypt
freetype
awscli
bash-completion
dos2unix
tree
htop
nmap
links
geoip
watch
kubernetes-cli
docker
docker-compose
node
python@2
python
)
echo "Checking various packages and installing or upgrading."
for package in "${PACKAGES[@]}"
do
:
installed=$(find "/usr/local/Cellar/$package" -type d -maxdepth 1)
if [[ -z $installed ]]; then
brew install $package
else
brew upgrade $package
fi
done
#echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.zshrc
export LDFLAGS="-L/usr/local/opt/sqlite/lib"
export CPPFLAGS="-I/usr/local/opt/sqlite/include"
# Setting up Node et-al
export PATH="/usr/local/bin:$PATH"
rm -rf /usr/local/lib/node_modules
# Ensure NODE_PATH is set
grep NODE_PATH ~/.bash_profile > /dev/null || cat "export NODE_PATH=/usr/local/lib/node_modules" >> ~/.bash_profile && . ~/.bash_profile
npm install -g grunt-cli gulp yarn async aws-sdk
# Update $PATH for Python install
export PATH=/usr/local/share/python:$PATH
# Update Python
python -m pip install --upgrade pip
PYTHON_PACKAGES=(
ipython
virtualenv
virtualenvwrapper
numpy
scipy
matplotlib
ipython[all]
)
sudo pip install ${PYTHON_PACKAGES[@]}
# Cask allows you to easy install Mac OS GUI apps and binaries directly from the command line using Homebrew.
# First you install cask, and then you can install normal Mac apps directly from the command line.
if brew ls --versions cask > /dev/null; then
brew install cask
else
brew upgrade cask
fi
CASKS=(
google-chrome
visual-studio-code
iterm2
google-cloud-sdk
firefox
slack
)
for cask in ${CASKS[@]}
do
installed=$(find "/usr/local/Caskroom/$cask" -type d -maxdepth 1)
if [[ -z $installed ]]; then
echo "${red}${cask}${reset} requires ${red}update${reset}."
brew cask install $cask
else
brew cask upgrade $cask --force
fi
done
# Setup Docker
etc=/Applications/Docker.app/Contents/Resources/etc
ln -sf $etc/docker.bash-completion $(brew --prefix)/etc/bash_completion.d/docker
ln -sf $etc/docker-machine.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-machine
ln -sf $etc/docker-compose.bash-completion $(brew --prefix)/etc/bash_completion.d/docker-compose
# Setup command completion for Google Cloud
source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/completion.bash.inc
source /usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk/path.bash.inc
brew tap caskroom/fonts
FONTS=(
font-ubuntu
font-raleway
)
brew cask install ${FONTS[@]}
# 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
# defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad Clicking -bool true
# defaults -currentHost write NSGlobalDomain com.apple.mouse.tapBehavior -int 1
# Disable "natural" scroll
# defaults write NSGlobalDomain com.apple.swipescrolldirection -bool false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment