1/9/2014 - 1:45 AM

OS X Configuration

OS X Configuration

#Mac OS X

Mensch coding font


#Xcode Command Line Tools

Xcode > Preferences > Downloads > Command Line Tools


Switch to z-shell

curl -L | sh

Update .zshrc

subl ~/.zshrc
plugins=(git osx rails3 ruby github node npm brew)
source $ZSH/
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/usr/X11/bin

Install rvm

\curl -L | bash -s stable
rvm requirements

Install rubies

rvm get head
rvm install 1.9.3

OS X Preferences

#Fix fonth smoothing
defaults -currentHost write -globalDomain AppleFontSmoothing -int 0

#Disable window animations
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

#Enable repeat on keydown
defaults write -g ApplePressAndHoldEnabled -bool false

#Disable webkit homepage
defaults write org.webkit.nightly.WebKit StartPageDisabled -bool true

#Use current directory as default search scope in Finder
defaults write FXDefaultSearchScope -string "SCcf"

#Show Path bar in Finder
defaults write ShowPathbar -bool true

#Show Status bar in Finder
defaults write ShowStatusBar -bool true

#Show indicator lights for open applications in the Dock
defaults write show-process-indicators -bool true

#Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write BrowseAllInterfaces -bool true

#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

#Disable disk image verification
defaults write skip-verify -bool true &&
defaults write skip-verify-locked -bool true &&
defaults write skip-verify-remote -bool true

#Disable Safari’s thumbnail cache for History and Top Sites
defaults write DebugSnapshotsUpdatePolicy -int 2

#Enable Safari’s debug menu
defaults write IncludeInternalDebugMenu -bool true

#Disable the Ping sidebar in iTunes
defaults write disablePingSidebar -bool true

#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

#Disable ping dropdowns
defaults write hide-ping-dropdown true

Set hostname

sudo scutil --set HostName Work


ruby -e "$(curl -fsSL"
brew install git ack wget curl memcached libmemcached readline sqlite gdbm pkg-config

Install python

brew install python --framework --universal

Add into your ~/.zshrc

export PATH=/usr/local/share/python:$PATH

Change system symlinks

cd /System/Library/Frameworks/Python.framework/Versions
sudo rm Current
ln -s /usr/local/Cellar/python/2.7.2/Frameworks/Python.framework/Versions/Current

Install pip & virtualenv

easy_install pip
pip install virtualenv
pip install virtualenvwrapper

Source virtualenvwrapper script

source /usr/local/bin/


Setup Github

ssh-keygen -t rsa -C ""

#copy ssh key to
subl ~/.ssh/

#test connection
ssh -T

#set git config values
git config --global "Marc Lundgren"
git config --global ""
git config --global github.user marclundgren
git config --global github.token your_token_here

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

#Sublime Text

Add Sublime Text CLI

sudo mkdir -p "/usr/local/bin/" && ln -s "/Applications/Sublime Text" "/usr/local/bin/subl"

Install Package Control

import urllib2,os; pf='Package Control.sublime-package'; ipp=sublime.installed_packages_path(); os.makedirs(ipp) if not os.path.exists(ipp) else None; urllib2.install_opener(urllib2.build_opener(urllib2.ProxyHandler())); open(os.path.join(ipp,pf),'wb').write(urllib2.urlopen(''+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

Install Soda Theme

git clone git:// ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Theme\ -\ Soda

Install Tomorrow Theme

git clone git:// ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Color\ Scheme\ -\ Tomorrow


    "close_windows_when_empty": true,
    "default_encoding": "UTF-8",
    "fallback_encoding": "Cyrillic (Windows 1251)",
    "font_face": "Mensch",
    "font_size": 14,
    "highlight_line": true,
    "highlight_modified_tabs": true,
    "margin": 2,
    "open_files_in_new_window": false,
    "show_full_path": true,
    "show_tab_close_buttons": true,
    "soda_classic_tabs": false,
    "soda_folder_icons": true,
    "spell_check": true,
    "tab_size": 2,
    "theme": "Soda Dark 3.sublime-theme",
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true,
    "use_simple_full_screen": true,
    "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?"

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"} }


git clone "/Users/Joel/Library/Application Support/Sublime Text 2/Packages/Byte"


Install dnsmasq

brew install dnsmasq

Add DNS Domains

mkdir -p /usr/local/etc/ &&
echo "address=/build/" >> /usr/local/etc/dnsmasq.conf && 
echo "address=/stage/" >> /usr/local/etc/dnsmasq.conf && 
echo "listen-address=" >> /usr/local/etc/dnsmasq.conf

Enable dnsmasq daemon

sudo cp "/usr/local/Cellar/dnsmasq/2.57/homebrew.mxcl.dnsmasq.plist" "/Library/LaunchDaemons" &&
sudo launchctl load -w "/Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist"

Add Localhost to /etc/resolver

sudo -s
sudo mkdir -p /etc/resolver
sudo echo 'nameserver' > /etc/resolver/build

#flush cache
dscacheutil -flushcache

#ensure it works
scutil --dns


brew install mysql

MySQL Settings

#setup daemon
mkdir -p ~/Library/LaunchAgents && cp /usr/local/Cellar/mysql/5.5.20/homebrew.mxcl.mysql.plist ~/Library/LaunchAgents/ && 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
mysql.server start

#secure mysql


brew install --without-ossp-uuid

PostgreSQL Settings

#create database
initdb /usr/local/var/postgres

mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/postgresql/9.0.4/org.postgresql.postgres.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.postgresql.postgres.plist

#fix the psql error
sudo mkdir /var/pgsql_socket/
ln -s /private/tmp/.s.PGSQL.5432 /var/pgsql_socket/

#create user and databases
createuser user
createdb -Ouser -Eutf8 -T template0 user_development
createdb -Ouser -Eutf8 -T template0 user_test

Install nginx

brew install nginx

Configure your /usr/local/etc/nginx/nginx.conf (similar to):

server {
    listen       80;
    server_name  localhost;
    root   /path/to/phpfiles;
    index  index.php index.html index.htm;

    location / {
        # error_page 405 = $uri;

    location ~ .php {
         include fastcgi_params;
         fastcgi_index index.php;
         fastcgi_param SCRIPT_FILENAME /path/to/phpfiles$fastcgi_script_name;

Start nginx:

/usr/local/sbin/nginx -c /usr/local/etc/nginx/nginx.conf