Skip to content

Instantly share code, notes, and snippets.

@mgmilcher
Forked from g3d/gist:2709563
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mgmilcher/9892489 to your computer and use it in GitHub Desktop.
Save mgmilcher/9892489 to your computer and use it in GitHub Desktop.
OSX Chill Defaults

Mac OS X Setup

Source Code Pro coding font

Apps

#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

Settings

{
    "close_windows_when_empty": true,
    "default_encoding": "UTF-8",
    "font_face": "Source Code Pro Light",
    "font_size": 14,
    "highlight_line": true,
    "highlight_modified_tabs": true,
    "ignored_packages":
    [
        "Vintage"
    ],
    "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": 4,
    "theme": "Soda Dark.sublime-theme",
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true,
    "use_simple_full_screen": true,
    "word_separators": "./\\()\"'-:,.;<>~!@#%^&*|+=[]{}`~?",
    "rulers": [80]
}

Dotfiles & Preferences

git clone https://github.com/mgmilcher/dotfiles.git && cd dotfiles && ./sync.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

Git

Setup Github

#test connection
ssh -T git@github.com

#set git config values
git config --global user.name "Marius Milcher"
git config --global user.email "mgmilcher@gmail.com"
git config --global github.user mgmilcher

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

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

#Server

Set hostname

sudo scutil --set HostName Work

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

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

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