Create a gist now

Instantly share code, notes, and snippets.

@g3d /gist:2709563 forked from saetia/gist:1623487
Last active Mar 15, 2017

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

####Homebrew

# install package manager
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

# install homebrew packages
brew install \
tree \
node \
ssh-copy-id \
wget \
jpegoptim \
pngcrush \
colordiff \
imagemagick \
graphicsmagick \
ack \
caskroom/cask/brew-cask

####Homebrew Web Server Packages

brew install \
rabbitmq \
dnsmasq \
nginx \
mariadb \
redis \
memcached \
libmemcached \

####Homebrew Cask Apps & Fonts

# add support for fonts
brew tap caskroom/fonts

#add dev/beta versions
brew tap caskroom/versions

#install mac apps & fonts
brew cask install \
font-source-code-pro \
adobe-creative-cloud \
blueharvest \
cleanmymac \
cocktail \
ghostlab \
coda \
sublime-text-dev \
virtualbox \
coderunner \
google-chrome \
firefox \
codekit \
iterm2-beta \
sequel-pro \
querious \
imageoptim \
imagealpha \
xquartz \
simpholders-2-alpha \
handbrake \
vagrant \
ksdiff \
spotify \
launchrocket

#Shell

Switch to z-shell

brew install zsh
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 -L https://get.rvm.io | bash -s stable
rvm requirements

OR Install rbenv

brew install rbenv

Install rubies

rvm install 2.3.0 # OR
rbenv install 2.3.0

OS X Preferences

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

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

# Set a blazingly fast keyboard repeat rate
defaults write NSGlobalDomain KeyRepeat -int 0

# Disable window animations ("new window" scale effect)
defaults write NSGlobalDomain NSAutomaticWindowAnimationsEnabled -bool false

# Turn on dashboard-as-space
defaults write com.apple.dashboard enabled-state 2

# Use plain text mode for new TextEdit documents
defaults write com.apple.TextEdit RichText -int 0

# Make top-right hotspot start screensaver
defaults write com.apple.dock wvous-tr-corner -int 5 && \
defaults write com.apple.dock wvous-tr-modifier -int 0

# Set default Finder location to home folder (~/)
defaults write com.apple.finder NewWindowTarget -string "PfLo" && \
defaults write com.apple.finder NewWindowTargetPath -string "file://${HOME}"

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

# Disable ext change warning
defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

# Check for software updates daily, not just once per week
defaults write com.apple.SoftwareUpdate ScheduleFrequency -int 1

# 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 icons for hard drives, servers, and removable media on the desktop
defaults write com.apple.finder ShowExternalHardDrivesOnDesktop -bool true && \
defaults write com.apple.finder ShowHardDrivesOnDesktop -bool true && \
defaults write com.apple.finder ShowMountedServersOnDesktop -bool true && \
defaults write com.apple.finder ShowRemovableMediaOnDesktop -bool true

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

# 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

# Trackpad: map bottom right corner to right-click
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadCornerSecondaryClick -int 2 && \
defaults write com.apple.driver.AppleBluetoothMultitouch.trackpad TrackpadRightClick -bool true && \
defaults -currentHost write NSGlobalDomain com.apple.trackpad.trackpadCornerClickBehavior -int 1 && \
defaults -currentHost write NSGlobalDomain com.apple.trackpad.enableSecondaryClick -bool true

# Enable the Develop menu and the Web Inspector in Safari
defaults write com.apple.Safari IncludeInternalDebugMenu -bool true && \
defaults write com.apple.Safari IncludeDevelopMenu -bool true && \
defaults write com.apple.Safari WebKitDeveloperExtrasEnabledPreferenceKey -bool true && \
defaults write com.apple.Safari com.apple.Safari.ContentPageGroupIdentifier.WebKit2DeveloperExtrasEnabled -bool true && \
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true

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

# Show absolute path in finder's title bar. 
defaults write com.apple.finder _FXShowPosixPathInTitle -bool YES

# Auto-play videos when opened with QuickTime Player
defaults write com.apple.QuickTimePlayerX MGPlayMovieOnOpen 1

# Enable AirDrop over Ethernet and on unsupported Macs
defaults write com.apple.NetworkBrowser BrowseAllInterfaces -bool true

# Disable WebkitNightly.app's homepage
defaults write org.webkit.nightly.WebKit StartPageDisabled -bool true

Set hostname

sudo scutil --set HostName Work

Install python

brew install python3

Install virtualenv with pip

pip3 install virtualenv
pip3 install virtualenvwrapper

Source virtualenvwrapper script

VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 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 3.app/Contents/SharedSupport/bin/subl" "/usr/local/bin/subl"

Install Package Control

import urllib.request,os,hashlib; h = '2915d1851351e5ee549c20394736b442' + '8bc59f460fa1548d1514676163dafc88'; 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)

Settings

{
	"always_show_minimap_viewport": true,
	"bold_folder_labels": true,
	"close_windows_when_empty": true,
	"default_encoding": "UTF-8",
	"default_line_ending": "unix",
	"ensure_newline_at_eof_on_save": true,
	"fallback_encoding": "Cyrillic (Windows 1251)",
	"font_face": "Mensch",
	"font_size": 15,
	"highlight_line": true,
	"highlight_modified_tabs": true,
	"ignored_packages":
	[
		"Vintage"
	],
	"indent_guide_options":
	[
		"draw_normal",
		"draw_active"
	],
	"margin": 2,
	"material_theme_accent_lime": true,
	"material_theme_accent_orange": true,
	"material_theme_accent_purple": true,
	"material_theme_accent_red": true,
	"material_theme_accent_yellow": true,
	"material_theme_bold_tab": true,
	"material_theme_disable_fileicons": true,
	"material_theme_disable_folder_animation": true,
	"material_theme_disable_tree_indicator": true,
	"material_theme_small_statusbar": true,
	"material_theme_small_tab": true,
	"open_files_in_new_window": false,
	"overlay_scroll_bars": "enabled",
	"rulers":
	[
		80
	],
	"show_full_path": true,
	"show_tab_close_buttons": true,
	"soda_classic_tabs": false,
	"soda_folder_icons": true,
	"spell_check": false,
	"tab_size": 2,
	"translate_tabs_to_spaces": true,
	"trim_trailing_white_space_on_save": true,
	"use_simple_full_screen": true,
	"word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?",
	"word_wrap": "true"
}

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

#Server

Install pow

curl get.pow.cx | sh

MySQL

brew install mysql

MySQL Settings

# start mysql
mysql.server start

# secure mysql
mysql_secure_installation

# connecto to mysql
mysql -uroot

PostgreSQL

brew install postgres

PostgreSQL Settings

# connect to psql
psql -U `whoami` -d postgres

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

Manage homebrew installed packages with LaunchRocket

LaunchRocke Screenshot

Enjoy your new OS X!

aww yeah

@makaroni4

👍 Thanks for this gist!

@1um
1um commented Jun 20, 2013

Thanks!

@geksilla

Thanks man!

@philbritton

Thanks for the gist and the gif lol

@gdelfino
gdelfino commented Dec 5, 2013

Great!

@ysfjwd
ysfjwd commented Dec 17, 2013

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

@JacksonGariety

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
lareb commented Jan 16, 2014

awesome

@iSevenDays

thanks!

@anthonybrown

postgresql link is dead

just use brew postgresql --without-python

@anthonybrown

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

@ghost
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

No need to add python the the path

@marnen
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

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

@diek
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

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

@cschar
cschar commented Jan 22, 2016

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

@artifex404

Thanks! +1

@anthonybrown

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