Tr4pSt3R
1/29/2015 - 11:56 AM

My OSX-10.10-setup.md

Mac OS X 10.10 Yosemite

Custom recipe to get OS X 10.10 Yosemite running from scratch, setup applications and developer environment. I use this gist to keep track of the important software and steps required to have a functioning system after a semi-annual fresh install. On average, I reinstall each computer from scratch every 6 months, and I do not perform upgrades between distros.

This keeps the system performing at top speeds, clean of trojans, spyware, and ensures that I maintain good organizational practices for my content and backups. I highly recommend this.

You are encouraged to fork this and modify it to your heart's content to match your own needs.

Install Software

The software selected is software that is "tried and true" --- software I need after any fresh install. I often install other software not listed here, but is handled in a case-by-case basis.

Install from App Store

Install from Third-Party Websites

#Xcode Command Line Tools

Run Xcode and accept the license

Homebrew cannot install properly until this occurs.

xcode-select --install

#Homebrew

Install Homebrew

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor

At the time of this writing, brew doctor says that Xcode 6.1 is required, which means downloading it from the Apple Developer Center until it is released in the Mac App Store.

Install Homebrew extension Cask

brew install caskroom/cask/brew-cask

Install common applications via Homebrew

Databases are installed later.

brew install the_silver_searcher autojump automake colordiff curl git git-flow \
             hub icoutils imagemagick libmemcached memcached openssl ossp-uuid qt \
             readline redis tmux wget libxml2
             
brew install autojump automake colordiff curl git git-flow \
            hub icoutils imagemagick libmemcached memcached openssl ossp-uuid qt \
            readline redis tmux wget libxml2

Install applications via Homebrew Cask

brew cask install github
brew cask install google-chrome
brew cask install rescuetime
brew cask install rubymine
brew cask install vagrant
brew cask install vagrant-manager

Install Parallels plugin for Vagrant

vagrant plugin install vagrant-parallels

See http://parallels.github.io/vagrant-parallels/ for more details.

#Shell

Fish Shell

brew install fish

# Add Fish to /etc/shells, which will require an administrative password
echo "/usr/local/bin/fish" | sudo tee -a /etc/shells

# Make Fish your default shell
chsh -s /usr/local/bin/fish

# Create the Fish config directory
mkdir -p ~/.config/fish

# Create initial config file
subl ~/.config/fish/config.fish

# [Optional] Update completions:
fish_update_completions

Customisations

Fonts

.oh-my-Fish (level up Fish)

Get .oh-my-fish:

curl -L https://github.com/bpinto/oh-my-fish/raw/master/tools/install.fish | fish

Replace config file content with below:

set -g -x PATH $GEM_HOME/bin:$HOME/.rvm/bin:$PATH
set -g -x fish_greeting ''

# Path to your oh-my-fish.
set fish_path $HOME/.oh-my-fish

# Theme
set fish_theme bobthefish

# Which plugins would you like to load? (plugins can be found in ~/.oh-my-fish/plugins/*)
# Custom plugins may be added to ~/.oh-my-fish/custom/plugins/
set fish_plugins rvm bundler git brew gem node osx rails

# Path to your custom folder (default path is $FISH/custom)
#set fish_custom $HOME/dotfiles/oh-my-fish

# Load oh-my-fish configuration.
. $fish_path/oh-my-fish.fish

Dracula iTerm Theme

Dracula

OS X Preferences


#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

Set hostname

sudo scutil --set HostName thelab

#Git

Setup Github

ssh-keygen -t rsa -C mightyj@hotmail.co.uk

# Copy ssh key to github.com
cat ~/.ssh/id_rsa.pub

# Test connection
ssh -T git@github.com

# Set git config values
git config --global user.name "Jones Agyemang"
git config --global user.email "mightyj@hotmail.co.uk"
git config --global github.user Tr4pSt3R
git config --global github.token your_token_here

git config --global core.editor "subl -w"
git config --global color.ui true

#Install Ruby

# Install RVM
curl -L https://get.rvm.io | bash -s stable --ruby

# Set to global gemset 
rvm gemset use global

# Faster gem installation 
echo "gem: --no-document" >> ~/.gemrc

# Update default gems
gem outdated
gem update

# Get Nokogiri
gem install nokogiri

#Install Rails

# Create a new gemset for latest Rails and set as default
rvm use --default ruby-2.2.0@rails4.2 --create
gem install rails

Ruby Gems

libv8 / therubyracer

brew uninstall v8
gem uninstall libv8
brew install v8
gem install therubyracer
gem install libv8 -v 3.16.14.3 -- --with-system-v8

nokogiri (alternative solution if above fails)

brew tap homebrew/dupes
brew install libxml2 libxslt libiconv
gem install nokogiri -- --with-iconv-dir=/usr/local/Cellar/libiconv/VERSION/

capybara-webkit

brew install -v https://raw.github.com/cliffrowley/homebrew/patched_qt/Library/Formula/qt.rb --HEAD --without-ssse3
gem install capybara-webkit -v '0.9.0'

#Install NVM (node version manager)

curl https://raw.githubusercontent.com/Alex7Kom/nvm-fish/master/install.fish | fish

# Install latest Node
nvm install 0.10

# Set and alias it as default
nvm alias default 0.10.x

#Sublime Text

Add Sublime Text CLI

ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime

Install Package Control

Run Sublime Text 3 and access the console via the CTRL + ``` shortcut or theView > Show Console` menu.

import urllib.request,os,hashlib; h = '2deb499853c4371624f5a07e27c334aa' + 'bf8c4e67d14fb0525ba4f89698a6d7e1'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); urllib.request.install_opener( urllib.request.build_opener( urllib.request.ProxyHandler()) ); by = urllib.request.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); print('Error validating download (got %s instead of %s), please try manual install' % (dh, h)) if dh != h else open(os.path.join( ipp, pf), 'wb' ).write(by)

See https://sublime.wbond.net/installation for more information. Their site has a note that this install code will change for each new release, so it would be good to check once in a while.

Install Packages

  • AdvancedNewFile
  • Alignment
  • All AutoComplete
  • ApplySyntax
  • BeautifyRuby
  • BracketHighlighter
  • Cucumber
  • DashDoc
  • DocBlockr
  • Emmet
  • Emmet Css Snippets
  • ERB Snippets
  • GitGutter
  • JSHint Gutter
  • SideBarEnhancements
  • Scss
  • TrailingSpaces

Install Brogrammer Theme

# Install via package control as:
Theme - Brogrammer

Install Inconsolota Font

Inconsolota

Settings

Sublime Text > Preferences > Settings - User

{
  "auto_complete_commit_on_tab": true,
  "caret_style": "solid",
  "color_scheme": "Packages/Theme - Brogrammer/brogrammer.tmTheme",
  "draw_white_space": "all",
  "ensure_newline_at_eof_on_save": true,
  "file_exclude_patterns":
  [
    "*.pyc",
    "*.pyo",
    "*.exe",
    "*.dll",
    "*.obj",
    "*.o",
    "*.a",
    "*.lib",
    "*.so",
    "*.dylib",
    "*.ncb",
    "*.sdf",
    "*.suo",
    "*.pdb",
    "*.idb",
    "*.class",
    "*.psd",
    "*.db",
    "*.beam",
    ".DS_Store",
    ".tags"
  ],
  "folder_exclude_patterns":
  [
    ".svn",
    ".git",
    ".hg",
    "CVS",
    ".sass-cache"
  ],
  "font_face": "Inconsolata",
  "font_options":
  [
    "no_round"
  ],
  "font_size": 15,
  "highlight_line": true,
  "highlight_modified_tabs": true,
  "ignored_packages":
  [
    "Vintage",
    "Markdown"
  ],
  "scroll_past_end": false,
  "tab_size": 2,
  "theme": "Brogrammer.sublime-theme",
  "translate_tabs_to_spaces": true,
  "trim_trailing_white_space_on_save": true,
  "wide_caret": true,
  "word_separators": "./\\()\"'-:,.;<>~@#$%^&*|+=[]{}`~",
  "word_wrap": false
}

Key Bindings

[
  { "keys": ["super+b"], "command": "expand_selection", "args": {"to": "brackets"} },
  { "keys": ["super+f"], "command": "show_panel", "args": {"panel": "replace"} },
  { "keys": ["super+alt+f"], "command": "show_panel", "args": {"panel": "find"} }
]

Snippets

git clone git@github.com:bytestudios/sublime-snippets.git "/Users/Joel/Library/Application Support/Sublime Text 2/Packages/Byte"

Server

Docker

brew install docker boot2docker
boot2docker init
boot2docker up

MySQL

brew install mysql
brew pin mysql

MySQL Settings

# Copy launch agent into place
mkdir -p ~/Library/LaunchAgents && cp /usr/local/Cellar/mysql/VERSION/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/

# Edit launch agent and set both keepalive and launch at startup to false
vi ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

# Inject launch agent
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist

# Set up databases to run as your user account
unset TMPDIR && mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp

# Start mysql
start mysql

# Secure mysql
/usr/local/Cellar/mysql/VERSION/bin/mysql_secure_installation

PostgreSQL

brew install postgres --no-ossp-uuid
brew pin postgres

PostgreSQL Settings

# Initialize db if none exists already
initdb /usr/local/var/postgres

# Create launchctl script
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/VERSION/homebrew.mxcl.postgresql.plist ~/Library/LaunchAgents/

# Edit launchctl script (set to not start automatically and keepalive false)
subl ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

# Inject launchctl script
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

# Start PostgreSQL
start pg

MongoDB

brew install mongodb