Skip to content

Instantly share code, notes, and snippets.

@g3d
Forked from saetia/gist:1623487
Last active May 15, 2025 07:00
Show Gist options
  • Select an option

  • Save g3d/2709563 to your computer and use it in GitHub Desktop.

Select an option

Save g3d/2709563 to your computer and use it in GitHub Desktop.
Clean Install – OS X 10.11 El Capitan

#Mac OS X

Mensch coding font

Apps

#Xcode Command Line Tools

Xcode > Preferences > Downloads > Command Line Tools

#Shell

Switch to z-shell

curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh

Update .zshrc

subl ~/.zshrc
ZSH=$HOME/.oh-my-zsh
ZSH_THEME="candy"
plugins=(git osx rails3 ruby github node npm brew)
source $ZSH/oh-my-zsh.sh
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/mysql/bin:/usr/X11/bin

Install rvm

curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

Install rubies

rvm get head
rvm pkg install readline # need it to work correctly with utf-8 characters in irb/pry
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 com.apple.finder FXDefaultSearchScope -string "SCcf"

#Show Path bar in Finder
defaults write com.apple.finder ShowPathbar -bool true

#Show Status bar in Finder
defaults write com.apple.finder ShowStatusBar -bool true

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

#Enable AirDrop over Ethernet and on unsupported Macs running Lion
defaults write com.apple.NetworkBrowser 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 com.apple.frameworks.diskimages skip-verify -bool true &&
defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true &&
defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true

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

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

#Disable the Ping sidebar in iTunes
defaults write com.apple.iTunes 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 com.apple.iTunes hide-ping-dropdown true

Set hostname

sudo scutil --set HostName Work

#Homebrew

ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
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/virtualenvwrapper.sh

#Git

Setup Github

ssh-keygen -t rsa -C "g3dinua@gmail.com"

#copy ssh key to github.com
subl ~/.ssh/id_rsa.pub

#test connection
ssh -T git@github.com

#set git config values
git config --global user.name "Bohdan Viter"
git config --global user.email "g3dinua@gmail.com"
git config --global github.user g3d
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 2.app/Contents/SharedSupport/bin/subl" "/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('http://sublime.wbond.net/'+pf.replace(' ','%20')).read()); print 'Please restart Sublime Text to finish installation'

Install Soda Theme

git clone git://github.com/buymeasoda/soda-theme.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Theme\ -\ Soda

Install Tomorrow Theme

git clone git://github.com/chriskempson/textmate-tomorrow-theme.git ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/Color\ Scheme\ -\ Tomorrow

Settings

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

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

Install dnsmasq

brew install dnsmasq

Add DNS Domains

mkdir -p /usr/local/etc/ &&
echo "address=/build/127.0.0.1" >> /usr/local/etc/dnsmasq.conf && 
echo "address=/stage/192.168.10.200" >> /usr/local/etc/dnsmasq.conf && 
echo "listen-address=127.0.0.1" >> /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 127.0.0.1' > /etc/resolver/build

#flush cache
dscacheutil -flushcache

#ensure it works
scutil --dns

MySQL

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
/usr/local/Cellar/mysql/5.5.20/bin/mysql_secure_installation

PostgreSQL

brew install --without-ossp-uuid https://raw.github.com/briancunnie/homebrew/postgres-no-ossp-uuid/Library/Formula/postgresql.rb

PostgreSQL Settings

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

#autostart
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 / {
        # http://www.ruby-forum.com/topic/187939
        # error_page 405 = $uri;
    }

    location ~ .php {
         include fastcgi_params;
         fastcgi_pass 127.0.0.1:9000;
         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

aww yeah

@makaroni4
Copy link

👍 Thanks for this gist!

@1um
Copy link

1um commented Jun 20, 2013

Thanks!

@geksilla
Copy link

Thanks man!

@philbritton
Copy link

Thanks for the gist and the gif lol

@gdelfino
Copy link

gdelfino commented Dec 5, 2013

Great!

@debuggerpk
Copy link

hey, i wasn't able to launch fastcgi with it ...any idea what i am going wrong ?

@ColemanGariety
Copy link

I can't get the blazing fast key repeat to work. No matter what I set, no matter how many times I restart, it always seems to be the same. Only changes via system preferences.

@lareb
Copy link

lareb commented Jan 16, 2014

awesome

@iSevenDays
Copy link

thanks!

@anthonybrown
Copy link

postgresql link is dead

just use brew postgresql --without-python

@anthonybrown
Copy link

getting this error:
dyld: Library not loaded: /usr/local/lib/libpcre.1.dylib Referenced from: /usr/local/bin/nginx Reason: image not found [1] 39977 trace trap nginx
I had to brew install pcre --universal
to make it work

Copy link

ghost commented Apr 7, 2014

ruby <(curl -fsSkL raw.github.com/mxcl/homebrew/go)
curl: (22) The requested URL returned error: 404 Not Found

that works
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"

@anthonybrown
Copy link

No need to add python the the path

@marnen
Copy link

marnen commented Jun 5, 2014

Two points:

  • The "zsh installation" actually just installs oh-my-zsh.
  • The best way to install Postgres on Mac OS these days is Postgres.app.

@kimmobrunfeldt
Copy link

I gathered my own gist from various sources such as your gist: https://gist.github.com/kimmobrunfeldt/350f4898d1b82cf10bce

@diek
Copy link

diek commented Sep 9, 2014

I am hitting a wall on mysql_install_db. Error: zsh: command not found: mysql_install_db. I have searched but cannot find a solution.

@whimsyniche
Copy link

A great addition to this and I recommend you check out http://pow.cx/ and http://xip.io/

@cschar
Copy link

cschar commented Jan 22, 2016

Thanks a lot! sped up my fresh mac install to dev status

@artifex404
Copy link

Thanks! +1

@anthonybrown
Copy link

Still the best, just got a new MBP from work and set it up using this 👍
Thanks for updating too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment