Skip to content

Instantly share code, notes, and snippets.

@nate-thomas
Forked from codeinthehole/osx_bootstrap.sh
Last active November 23, 2020 22:20
Show Gist options
  • Save nate-thomas/f2d75064ed8e12e9c380ee4c3a821cdc to your computer and use it in GitHub Desktop.
Save nate-thomas/f2d75064ed8e12e9c380ee4c3a821cdc to your computer and use it in GitHub Desktop.
Script to install and setup stuff I
#!/usr/bin/env bash
#
# Script for setting up a new OSX machine
#
# Some apps don't have a cask and so still need to be installed by hand. These
# include:
#
#
# Notes:
#
# - If installing full Xcode, it's better to install that first from the app
# store before running the bootstrap script. Otherwise, Homebrew can't access
# the Xcode libraries as the agreement hasn't been accepted yet.
#
# Reading:
#
# - https://gist.github.com/MatthewMueller/e22d9840f9ea2fee4716
# - https://gist.github.com/codeinthehole/26b37efa67041e1307db
# - http://notes.jerzygangi.com/the-best-pgp-tutorial-for-mac-os-x-ever/
echo "Starting. . ."
# Check for Homebrew, install if we don't have it
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
# Install GNU core utilities (those that come with OS X are outdated)
echo "Installing utilities . . . "
brew tap homebrew/dupes
brew install coreutils
brew install gnu-sed --with-default-names
brew install gnu-tar --with-default-names
brew install gnu-indent --with-default-names
brew install gnu-which --with-default-names
# Install GNU `find`, `locate`, `updatedb`, and `xargs`, g-prefixed
brew install findutils
# Install Bash 4
brew install bash
PACKAGES=(
archey
cask
emacs
findutils
gcc
gettext
htop
hub
gifsicle
moreutils
mysql
nmap
node
openssl
postgresql
python
python3
sqlite
tmux
tree
vim
wget
)
echo "Installing packages. . ."
brew install ${PACKAGES[@]}
echo "Cleaning up. . ."
brew cleanup
CASKS=(
atom
eclipse-jee
firefox
flux
google-chrome
gpg-suite
java
iterm2
limechat
macvim
mono-mdk
skype
slack
sublime
vagrant
virtualbox
visual-studio
visual-studio-code
vlc
)
echo "Installing cask apps. . ."
brew cask install ${CASKS[@]}
echo "Installing Python packages..."
sudo asy_install pip
PYTHON_PACKAGES=(
ipython
virtualenv
virtualenvwrapper
)
sudo pip install ${PYTHON_PACKAGES[@]}
echo "Configuring OSX. . ."
# Set fast key repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0
# Require password as soon as screensaver 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
# Disable Dashboard
defaults write com.apple.dashboard mcx-disabled -boolean YES
# Disable Desktop
defaults write com.apple.finder CreateDesktop -bool false
killall Finder
# Show ~/Library
chflags nohidden ~/Library/
# Making Column View Mandatory
defaults write com.apple.finder FXPreferredViewStyle Clmv
# Show externals on your Desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true
# Bluetooth quality
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" -int 40
# Adding a space to your dock
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}'
killall Dock
echo "Creating folder structure..."
[[ ! -d Desktop/ISOs ]] && mkdir Desktop/ISOs
[[ ! -d Desktop/Wallpapers ]] && mkdir Desktop/Wallpapers
echo "Setting up your bash_profile. . ."
echo '
### .bash_profile is for login shells, which is iTerm by default.
export PS1="\[\033[36m\]\u\[\033[m\]@\[\033[32m\]\h:\[\033[33;1m\]\w\[\033[m\]\$ "
export CLICOLOR=1
export LSCOLORS=ExFxBxDxCxegedabagacad
alias ls="ls -GFh"
' >> ~./bash_profile
echo "
Complete! Enjoy your new OS!
"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment