9/6/2017 - 5:02 AM

Setup for OSX development environment

Setup for OSX development environment

#!/usr/bin/env bash
set -e # exit on any nonzero command

read -n1 -r -p "Make sure SSH keys are set up on remotes. Press space to continue..." key

if [ "$key" = '' ]; then

	# Remove default dotfiles that may exist
	if [ -f "$HOME/.profile" ]; then 
		rm "$HOME/.profile"
	if [ -f "$HOME/.bashrc" ]; then 
		rm "$HOME/.bashrc"
	if [ -f "$HOME/.bash_profile" ]; then 
		rm "$HOME/.bash_profile"
	if [ -f "$HOME/.localrc" ]; then 
		rm "$HOME/.localrc"
	if [ -f "$HOME/.bash_logout" ]; then 
		rm "$HOME/.bash_logout"
	if [ -f "$HOME/.viminfo" ]; then 
		rm "$HOME/.viminfo"
	## homebrew
	/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
	brew update && brew upgrade

	# tap
	brew tap caskroom/cask
	brew install Caskroom/cask/xquartz
	brew cask install java

	# basics
	brew install wget
	brew install coreutils
	brew install gnu-sed --default-names

	# git
	brew install git git-flow-avh bash-completion gnu-getopt
	curl https://raw.githubusercontent.com/petervanderdoes/git-flow-completion/develop/git-flow-completion.bash > git-flow-completion.bash
	chmod 755 git-flow-completion.bash
	mv git-flow-completion.bash ~/.git-flow-completion.sh
	brew install tig

	# utilities
	brew install imagemagick
	brew install libvpx
	brew install ffmpeg --with-libvpx
	brew install the_silver_searcher
	brew install tree
	brew install unrar
	brew install calc
	brew install htop
	brew install youtube-dl
	brew install p7zip
	brew install figlet
	brew install gsl
	# python
	brew install python --with-brewed-openssl

	# vim
	brew install mercurial
	brew install vim --with-python3 --with-tcl --with-perl --override-system-vi

	# shell
	brew install tmux
	brew install reattach-to-user-namespace
	brew install jq
	brew install ssh-copy-id
	brew install stow

	# Ruby
	brew install rbenv
	brew install ruby-build
	rbenv install 2.3.0
	rbenv rehash
	rbenv global 2.3.0
	rbenv rehash

	# Perl
	\curl -L http://install.perlbrew.pl | bash
	source ~/perl5/perlbrew/etc/bashrc
	perlbrew install perl-5.16.0
	perlbrew switch perl-5.16.0

	# node
	brew install node
	npm install -g grunt-cli

	## repositories
	mkdir -p ~/Sites/system/
	mkdir -p ~/Sites/work/
	mkdir -p ~/Sites/personal/

	cd ~/Sites/system && git clone git@github.com:jamestomasino/dotfiles.git
	cd ~/Sites/system/dotfiles && ./make

	# Ruby Gems
	gem install bundler

	# applications
	brew cask install iterm2
	brew cask install easysimbl
	brew cask install viscosity
	brew cask install veracrypt
	brew cask install slate
	brew cask install karabiner
	brew install tpp
	brew install newsbeuter

	# bash completions
	brew tap homebrew/completions
	brew install bundler-completion
	brew install gem-completion
	brew install grunt-completion
	brew install pip-completion
	# security
	brew install lastpass-cli --with-pinentry
	# pip installs
	pip install --user pyyaml
	pip install --user colorama
	pip install rtv
	# chat
	brew install profanity --with-terminal-notifier
	brew install irssi
	# audio
	brew install cmus
	# video
	brew install libcaca
	brew install mplayer --with-libcaca
	# mail
	brew tap neomutt/homebrew-neomutt
	brew install neomutt --with-s-lang --with-sidebar-patch --with-notmuch-patch
	cd ~/.mutt && git clone https://github.com/altercation/mutt-colors-solarized.git
	brew install urlview
	brew install pandoc
	brew install offlineimap
	# Configuration
	#Set a blazingly fast keyboard repeat rate
	defaults write NSGlobalDomain KeyRepeat -int 0.02

	#Set a shorter Delay until key repeat
	defaults write NSGlobalDomain InitialKeyRepeat -int 12

	#Add a context menu item for showing the Web Inspector in web views
	defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

	#Show the ~/Library folder
	chflags nohidden ~/Library

	#Store screenshots in subfolder on desktop
	mkdir ~/Desktop/Screenshots
	defaults write com.apple.screencapture location ~/Desktop/Screenshots

	#Disable the 'Are you sure you want to open this application?' dialog
	defaults write com.apple.LaunchServices LSQuarantine -bool false

	#Show percentage in battery status
	defaults write com.apple.menuextra.battery ShowPercent -string "YES"
	defaults write com.apple.menuextra.battery ShowTime -string "NO"
	#Disable Notification Center and remove the menu bar icon
	launchctl unload -w /System/Library/LaunchAgents/com.apple.notificationcenterui.plist

	#Disable rubberband scrolling
	defaults write -g NSScrollViewRubberbanding -bool false

	#Disable dashboard
	defaults write com.apple.dashboard mcx-disabled -boolean YES

	#Move dock to left side of screen
	defaults write com.apple.dock orientation -string left

	#Show all filename extensions in Finder
	defaults write NSGlobalDomain AppleShowAllExtensions -bool true

	#Expand save panel by default
	defaults write NSGlobalDomain NSNavPanelExpandedStateForSaveMode -bool true

	#Expand print panel by default
	defaults write NSGlobalDomain PMPrintingExpandedStateForPrint -bool true

	#Avoid creating .DS_Store files on network volumes
	defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true

	#Disable the warning when changing a file extension
	defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

	#Use list view in all Finder windows by default
	#Four-letter codes for the other view modes: icnv, Nlmv, Flwv
	defaults write com.apple.finder FXPreferredViewStyle -string "Nlmv"

	#Remove default text from basic screen saver
	defaults write ~/Library/Preferences/com.apple.ScreenSaver.Basic MESSAGE " "

	#Disable sound effect when changing volume
	defaults write -g com.apple.sound.beep.feedback -integer 0

	#Disable user interface sound effects
	defaults write com.apple.systemsound 'com.apple.sound.uiaudio.enabled' -int 0

	#Set system sounds volume to 0
	defaults write com.apple.systemsound com.apple.sound.beep.volume -float 0
	#Autohide Dock
	defaults write com.apple.dock autohide -bool true
	#Show/Hide Dock instantly
	defaults write com.apple.Dock autohide-delay -float 0
	defaults write com.apple.dock autohide-time-modifier -float 0

	#Kill affected applications, so the changes apply
	for app in Safari Finder Dock Mail SystemUIServer; do killall "$app" >/dev/null 2>&1; done

	# Instructions
	echo "- Open tmux and run plugin installers: \`I"
	echo "- Open vim and run :PlugInstall"
    echo "Aborting"
- Install XCode
- Make your user an admin
- Create SSH keys

    $ ssh-keygen

- Upload public key to Assembla & Github

    $ cat ~/.ssh/id_rsa.pub | pbcopy

- Fork this gist
- Update osx_setup below and update all references to jamestomasino's github account to your own
- Download the osx_setup file and set its permissions to executable

    $ chmod 755 osx_setup

- Run the osx_setup file

    $ ./osx_setup

- Run tmux and plugin installer

    $ tmux
    `I #(that's a backtick and capital I)

- Install helper for mouse scrolling in tmux

1) Download .dmg file here: https://bitheap.org/mouseterm/
2) Execute: `cd /Volumes/MouseTerm && cp -r MouseTerm.bundle /Library/Application\ Support/SIMBL/Plugins`

- Install Dropbox & Spideroak (if used) and match environment vars location:

1) Install Dropbox to ~/Sites/sync/Dropbox
2) Install Spideroak Hive to ~/Sites/sync/spideroak

    $ ln -s ~/Sites/sync/Dropbox ~/.dropbox/Dropbox
    $ ln -s ~/Sites/sync/spideroak ~/.spideroak
- Run Vim and vim's plugin installer

    $ vim