Skip to content

Instantly share code, notes, and snippets.

@ameeno
Forked from millermedeiros/osx_setup.md
Created April 23, 2022 07:36
Show Gist options
  • Save ameeno/1f0da3d2832f038154e52d5f52fc9f3c to your computer and use it in GitHub Desktop.
Save ameeno/1f0da3d2832f038154e52d5f52fc9f3c to your computer and use it in GitHub Desktop.

Revisions

  1. @millermedeiros millermedeiros revised this gist Apr 16, 2020. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -214,9 +214,9 @@ sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Vol
    defaults write com.apple.spotlight orderedItems -array \
    '{"enabled" = 1;"name" = "APPLICATIONS";}' \
    '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
    '{"enabled" = 1;"name" = "DIRECTORIES";}' \
    '{"enabled" = 1;"name" = "PDF";}' \
    '{"enabled" = 1;"name" = "FONTS";}' \
    '{"enabled" = 0;"name" = "DIRECTORIES";}' \
    '{"enabled" = 0;"name" = "PDF";}' \
    '{"enabled" = 0;"name" = "FONTS";}' \
    '{"enabled" = 0;"name" = "DOCUMENTS";}' \
    '{"enabled" = 0;"name" = "MESSAGES";}' \
    '{"enabled" = 0;"name" = "CONTACT";}' \
  2. @millermedeiros millermedeiros revised this gist Apr 16, 2020. 1 changed file with 25 additions and 85 deletions.
    110 changes: 25 additions & 85 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -64,18 +64,6 @@ npm install -g eslint
    npm install -g replace
    ```

    Set zsh as defaut shell:

    ```sh
    chsh -s /bin/zsh
    ```

    Also install [oh-my-zsh](https://ohmyz.sh/):

    ```sh
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    ```


    ### 4. Install softwares

    @@ -258,7 +246,21 @@ source: https://github.com/mathiasbynens/dotfiles/blob/master/.macos



    ### 6. Update `~/.zshrc`
    ### 6. Configure zsh

    Set zsh as defaut shell:

    ```sh
    chsh -s /bin/zsh
    ```

    Install [oh-my-zsh](https://ohmyz.sh/):

    ```sh
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    ```

    Edit the `~/.zshrc` file (after installing oh-my-zsh)

    ```sh
    ZSH_THEME="hyperzsh"
    @@ -272,80 +274,12 @@ alias ipt-vim="ipt -pm | xargs -o vim"
    alias ipt-gvim="ipt -pm | xargs -o gvim --remote-silent"
    ```

    I'm also using a tweaked [hyperzsh](https://github.com/tylerreckart/hyperzsh) theme:
    I'm also using a tweaked [hyperzsh](https://github.com/tylerreckart/hyperzsh)
    theme but I deleted the `_user_host` and `_python_venv` logic. I actually keep
    it on my Dropbox folder and just symlink it:

    ```sh
    # based on https://github.com/tylerreckart/hyperzsh
    # but deleted the _user_host and _python_venv
    # --------

    # The prompt
    PROMPT='%{$fg[cyan]%}%c $(git_prompt_info)%{$reset_color%}$(_git_time_since_commit)$(git_prompt_status)${_return_status}➜ '

    local _return_status="%{$fg[red]%}%(?..⍉ )%{$reset_color%}"

    # Format for git_prompt_long_sha() and git_prompt_short_sha()
    ZSH_THEME_GIT_PROMPT_SHA_BEFORE="%{$fg[yellow]%}"
    ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%} "

    ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
    ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
    ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%} "
    ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ "
    ZSH_THEME_GIT_PROMPT_CLEAN=" "
    ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}✓ "
    ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}△ "
    ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ "
    ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➜ "
    ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ "
    ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%}▲ "

    ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[white]%}"
    ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
    ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
    ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}"

    # Determine the time since last commit. If branch is clean,
    # use a neutral color, otherwise colors will vary according to time.
    function _git_time_since_commit() {
    # Only proceed if there is actually a commit.
    if git log -1 > /dev/null 2>&1; then
    # Get the last commit.
    last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
    now=$(date +%s)
    seconds_since_last_commit=$((now-last_commit))

    # Totals
    minutes=$((seconds_since_last_commit / 60))
    hours=$((seconds_since_last_commit/3600))

    # Sub-hours and sub-minutes
    days=$((seconds_since_last_commit / 86400))
    sub_hours=$((hours % 24))
    sub_minutes=$((minutes % 60))

    if [ $hours -ge 24 ]; then
    commit_age="${days}d "
    elif [ $minutes -gt 60 ]; then
    commit_age="${sub_hours}h${sub_minutes}m "
    else
    commit_age="${minutes}m "
    fi
    if [[ -n $(git status -s 2> /dev/null) ]]; then
    if [ "$hours" -gt 4 ]; then
    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
    elif [ "$minutes" -gt 30 ]; then
    COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
    else
    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
    fi
    else
    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
    fi

    echo "$COLOR$commit_age%{$reset_color%}"
    fi
    }
    ln -s ~/Dropbox/dotfiles/hyperzsh.zsh-theme ~/.oh-my-zsh/custom/themes/hyperzsh.zsh-theme
    ```


    @@ -478,6 +412,12 @@ set -g default-command /bin/zsh
    set -g default-shell /bin/zsh
    ```

    I actually keep this on my Dropbox folder and just symlink it:

    ```sh
    ln -s ~/Dropbox/dotfiles/tmux.config ~/.tmux.config
    ```

    TODO: borrow tmux settings from [@ruyadorno](https://github.com/ruyadorno/installme-osx/)


  3. @millermedeiros millermedeiros revised this gist Apr 16, 2020. 1 changed file with 184 additions and 129 deletions.
    313 changes: 184 additions & 129 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -1,14 +1,13 @@
    Setup Mac OS X
    ==============

    **Edit:** I've done the same process every couple years since 2013 (Mountain Lion, Mavericks and High Sierra).
    I've done the same process every couple years since 2013 (Mountain
    Lion, Mavericks, High Sierra, Catalina) and I updated the Gist each time I've
    done it.

    I just replaced the hard drive of my mbp and decided to do a clean install of
    Mountain Lion (10.8.5) since I was still using Snow Leopard (10.6.8).

    I kinda regret for not using [Boxen](http://boxen.github.com/) to automate the
    process, but TBH I have this laptop for almost 3yrs and this is the first
    time I needed to reinstall everything, maybe the next time...
    I kinda regret for not using something like [Boxen](https://github.com/boxen/our-boxen/)
    (or anything similar) to automate the process, but TBH I only actually needed to
    these steps once every couple years...

    This gist is just a personal reference in case I need to do it all over again.
    **I'm by no means an OSX/*nix expert, use with care.**
    @@ -27,8 +26,8 @@ Make sure everything is up to date.
    > NOTE: homebrew now automatically installs command line tools, so you can skip this step.
    "Command Line Tools" can be downloaded separate from Xcode at
    https://developer.apple.com/downloads/ - It is way smaller than installing the
    whole Xcode but might not work for all cases tho.
    https://developer.apple.com/downloads/ It is way smaller than installing the
    whole Xcode but might not work for all cases tho — or you can run `xcode-select --install`

    Xcode can be found on App Store. **preferred**

    @@ -41,14 +40,15 @@ http://brew.sh/

    ```sh
    # install homebrew
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

    brew install git
    brew install node
    brew install wget
    brew install z
    brew install ag
    brew install ack
    brew install fd
    brew install ffind
    brew install fpp
    brew install tmux
    @@ -64,14 +64,26 @@ npm install -g eslint
    npm install -g replace
    ```

    Set zsh as defaut shell:

    ```sh
    chsh -s /bin/zsh
    ```

    Also install [oh-my-zsh](https://ohmyz.sh/):

    ```sh
    sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
    ```


    ### 4. Install softwares


    #### homebrew-cask

    Many softwares can be installed through
    [homebrew-cask](https://github.com/phinze/homebrew-cask) which makes the
    [homebrew-cask](https://github.com/Homebrew/homebrew-cask) which makes the
    process way simpler:

    ```sh
    @@ -86,37 +98,33 @@ brew cask install imagealpha
    brew cask install imageoptim
    brew cask install iterm2
    brew cask install macvim
    brew cask install sequel-pro
    brew cask install virtualbox
    brew cask install vagrant

    # utils
    brew cask install divvy
    brew cask install istat-menus
    brew cask install the-unarchiver
    brew cask install vlc
    # brew cask install the-unarchiver

    # browsers
    brew cask install firefox
    brew cask install google-chrome

    # others
    brew cask install limechat
    brew cask install skype
    # brew cask install limechat
    # brew cask install skype
    brew cask install rightzoom
    # brew cask install vlc

    # quick look plugins (https://github.com/sindresorhus/quick-look-plugins)
    brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlimagesize webpquicklook suspicious-package quicklookase qlvideo
    ```


    #### App Store

    - [Gifski](https://gif.ski/) (convert video into high-quality Gifs)
    - [Amphetamine](https://itunes.apple.com/us/app/amphetamine/id937984704?mt=12) (prevent mac from sleeping)

    #### Manually

    - [Backblaze](www.backblaze.com)
    - [Firefox Nightly](http://nightly.mozilla.org/)
    - [Chrome Canary](https://www.google.com/intl/en/chrome/browser/canary.html) ([how to set canary as default browser](http://aaltonen.co/2011/05/06/make-chrome-canary-the-default-browser-on-mac-os-x/))
    - Adobe Suite (Photoshop, Illustrator, ...)
    @@ -134,10 +142,6 @@ brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlimagesize we
    # Disable the sound effects on boot
    sudo nvram SystemAudioVolume=" "

    # Menu bar: show remaining battery time (on pre-10.8); hide percentage
    defaults write com.apple.menuextra.battery ShowPercent -string "NO"
    defaults write com.apple.menuextra.battery ShowTime -string "YES"


    ###############################################################################
    # Finder #
    @@ -158,6 +162,10 @@ defaults write com.apple.finder QLEnableTextSelection -bool true
    # Disable the warning when changing a file extension
    defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

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

    # Enable snap-to-grid for icons on the desktop and in other icon views
    /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
    /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
    @@ -169,7 +177,7 @@ defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false
    ###############################################################################

    # Save screenshots to the desktop
    defaults write com.apple.screencapture location -string "$HOME/Desktop"
    defaults write com.apple.screencapture location -string "${HOME}/Desktop"

    # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
    defaults write com.apple.screencapture type -string "png"
    @@ -207,13 +215,20 @@ defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true
    # been indexed before.
    # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
    sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
    # Change indexing order and disable some file types
    # Change indexing order and disable some search results
    # Yosemite-specific search results (remove them if you are using macOS 10.9 or older):
    # MENU_DEFINITION
    # MENU_CONVERSION
    # MENU_EXPRESSION
    # MENU_SPOTLIGHT_SUGGESTIONS (send search queries to Apple)
    # MENU_WEBSEARCH (send search queries to Apple)
    # MENU_OTHER
    defaults write com.apple.spotlight orderedItems -array \
    '{"enabled" = 1;"name" = "APPLICATIONS";}' \
    '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
    '{"enabled" = 1;"name" = "DIRECTORIES";}' \
    '{"enabled" = 0;"name" = "PDF";}' \
    '{"enabled" = 0;"name" = "FONTS";}' \
    '{"enabled" = 1;"name" = "PDF";}' \
    '{"enabled" = 1;"name" = "FONTS";}' \
    '{"enabled" = 0;"name" = "DOCUMENTS";}' \
    '{"enabled" = 0;"name" = "MESSAGES";}' \
    '{"enabled" = 0;"name" = "CONTACT";}' \
    @@ -224,121 +239,179 @@ defaults write com.apple.spotlight orderedItems -array \
    '{"enabled" = 0;"name" = "MOVIES";}' \
    '{"enabled" = 0;"name" = "PRESENTATIONS";}' \
    '{"enabled" = 0;"name" = "SPREADSHEETS";}' \
    '{"enabled" = 0;"name" = "SOURCE";}'
    '{"enabled" = 0;"name" = "SOURCE";}' \
    '{"enabled" = 0;"name" = "MENU_DEFINITION";}' \
    '{"enabled" = 0;"name" = "MENU_OTHER";}' \
    '{"enabled" = 0;"name" = "MENU_CONVERSION";}' \
    '{"enabled" = 0;"name" = "MENU_EXPRESSION";}' \
    '{"enabled" = 0;"name" = "MENU_WEBSEARCH";}' \
    '{"enabled" = 0;"name" = "MENU_SPOTLIGHT_SUGGESTIONS";}'
    # Load new settings before rebuilding the index
    killall mds
    killall mds > /dev/null 2>&1
    # Make sure indexing is enabled for the main volume
    sudo mdutil -i on /
    sudo mdutil -i on / > /dev/null
    # Rebuild the index from scratch
    sudo mdutil -E /
    sudo mdutil -E / > /dev/nule
    ```

    source: https://github.com/mathiasbynens/dotfiles/blob/master/.macos



    ### 6. Create/Update `~/.bash_profile`
    ### 6. Update `~/.zshrc`

    ```sh
    export PS1='\w \$ '
    ZSH_THEME="hyperzsh"

    set -o vi

    export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
    export NODE_PATH="/usr/local/lib/node_modules:$NODE_PATH"

    alias gvim="/Applications/MacVim.app/Contents/MacOS/Vim -g"
    alias g="gvim --remote-silent"
    alias cask="brew cask"
    plugins=(gitfast fd nvm vi-mode z)

    alias ipt-lg="git log --pretty=format:'%h | %<(80)%s | %<(12)%cr | %<(20)%an | %d' -15 | ipt --size 15 | sed 's#^[^0-9a-z]*\([0-9a-z]*\).*#\1#' | xargs git checkout"
    alias ipt-branch="git branch | ipt | xargs git checkout"
    alias ipt-bdelete="git branch | ipt -m | xargs git branch -D"
    alias ipt-vim="ipt -pm | xargs -o vim"
    alias ipt-gvim="ipt -pm | xargs -o gvim --remote-silent"
    ```

    # https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
    if [ -f ~/.bash/git-completion.sh ]; then
    source ~/.bash/git-completion.sh
    fi

    # `npm completion > ~/.bash/npm-completion.bash`
    if [ -f ~/.bash/npm-completion.sh ]; then
    source ~/.bash/npm-completion.sh
    fi

    # borrowed from http://petdance.com/2013/04/my-bash-prompt-with-gitsvn-branchstatus-display/
    if [ -f ~/.bash/prompt.sh ]; then
    source ~/.bash/prompt.sh
    fi
    I'm also using a tweaked [hyperzsh](https://github.com/tylerreckart/hyperzsh) theme:

    # enable the "z" command
    . `brew --prefix`/etc/profile.d/z.sh
    ```sh
    # based on https://github.com/tylerreckart/hyperzsh
    # but deleted the _user_host and _python_venv
    # --------

    # The prompt
    PROMPT='%{$fg[cyan]%}%c $(git_prompt_info)%{$reset_color%}$(_git_time_since_commit)$(git_prompt_status)${_return_status}➜ '

    local _return_status="%{$fg[red]%}%(?..⍉ )%{$reset_color%}"

    # Format for git_prompt_long_sha() and git_prompt_short_sha()
    ZSH_THEME_GIT_PROMPT_SHA_BEFORE="%{$fg[yellow]%}"
    ZSH_THEME_GIT_PROMPT_SHA_AFTER="%{$reset_color%} "

    ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}"
    ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%}"
    ZSH_THEME_GIT_PROMPT_DIRTY=" %{$fg[red]%}✗%{$reset_color%} "
    ZSH_THEME_GIT_PROMPT_UNTRACKED="%{$fg[white]%}◒ "
    ZSH_THEME_GIT_PROMPT_CLEAN=" "
    ZSH_THEME_GIT_PROMPT_ADDED="%{$fg[cyan]%}✓ "
    ZSH_THEME_GIT_PROMPT_MODIFIED="%{$fg[yellow]%}△ "
    ZSH_THEME_GIT_PROMPT_DELETED="%{$fg[red]%}✖ "
    ZSH_THEME_GIT_PROMPT_RENAMED="%{$fg[blue]%}➜ "
    ZSH_THEME_GIT_PROMPT_UNMERGED="%{$fg[cyan]%}§ "
    ZSH_THEME_GIT_PROMPT_AHEAD="%{$fg[blue]%}▲ "

    ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT="%{$fg[white]%}"
    ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM="%{$fg[yellow]%}"
    ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG="%{$fg[red]%}"
    ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL="%{$fg[white]%}"

    # Determine the time since last commit. If branch is clean,
    # use a neutral color, otherwise colors will vary according to time.
    function _git_time_since_commit() {
    # Only proceed if there is actually a commit.
    if git log -1 > /dev/null 2>&1; then
    # Get the last commit.
    last_commit=$(git log --pretty=format:'%at' -1 2> /dev/null)
    now=$(date +%s)
    seconds_since_last_commit=$((now-last_commit))

    # Totals
    minutes=$((seconds_since_last_commit / 60))
    hours=$((seconds_since_last_commit/3600))

    # Sub-hours and sub-minutes
    days=$((seconds_since_last_commit / 86400))
    sub_hours=$((hours % 24))
    sub_minutes=$((minutes % 60))

    if [ $hours -ge 24 ]; then
    commit_age="${days}d "
    elif [ $minutes -gt 60 ]; then
    commit_age="${sub_hours}h${sub_minutes}m "
    else
    commit_age="${minutes}m "
    fi
    if [[ -n $(git status -s 2> /dev/null) ]]; then
    if [ "$hours" -gt 4 ]; then
    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_LONG"
    elif [ "$minutes" -gt 30 ]; then
    COLOR="$ZSH_THEME_GIT_TIME_SHORT_COMMIT_MEDIUM"
    else
    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_SHORT"
    fi
    else
    COLOR="$ZSH_THEME_GIT_TIME_SINCE_COMMIT_NEUTRAL"
    fi

    echo "$COLOR$commit_age%{$reset_color%}"
    fi
    }
    ```


    ### 7. Create/Update `~/.gitconfig`

    ```gitconfig
    ; I removed the [user] block on purpose so other people don't copy it by mistake
    ; you will need to set these values
    ; I removed the [user] and [github] blocks on purpose so other people don't copy it by mistake
    ; you will need to set these values later
    [apply]
    whitespace = fix
    whitespace = fix
    [color]
    ui = auto
    ui = auto
    [color "branch"]
    current = yellow reverse
    local = yellow
    remote = green
    current = yellow reverse
    local = yellow
    remote = green
    [color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
    [color "status"]
    added = yellow
    changed = green
    untracked = cyan
    added = yellow
    changed = green
    untracked = cyan
    [merge]
    log = true
    log = true
    [push]
    ; "simple" avoid headaches, specially if you use `--force` w/o specifying branch
    ; see: http://stackoverflow.com/questions/13148066/warning-push-default-is-unset-its-implicit-value-is-changing-in-git-2-0
    default = simple
    ; "simple" avoid headaches, specially if you use `--force` w/o specifying branch
    ; see: http://stackoverflow.com/questions/13148066/warning-push-default-is-unset-its-implicit-value-is-changing-in-git-2-0
    default = simple
    [url "git://github.com/"]
    insteadOf = "github:"
    insteadOf = "github:"
    [url "[email protected]:"]
    insteadOf = "gh:"
    pushInsteadOf = "github:"
    pushInsteadOf = "git://github.com/"
    insteadOf = "gh:"
    pushInsteadOf = "github:"
    pushInsteadOf = "git://github.com/"
    [url "[email protected]:millermedeiros/"]
    insteadOf = "mm:"
    insteadOf = "mm:"
    [url "[email protected]:mout/"]
    insteadOf = "mout:"
    insteadOf = "mout:"
    [core]
    excludesfile = ~/.gitignore_global
    ; setting the editor fixes git commit bug http://tooky.co.uk/2010/04/08/there-was-a-problem-with-the-editor-vi-git-on-mac-os-x.html
    editor = /usr/bin/vim
    excludesfile = ~/.gitignore_global
    ; setting the editor fixes git commit bug http://tooky.co.uk/2010/04/08/there-was-a-problem-with-the-editor-vi-git-on-mac-os-x.html
    editor = /usr/bin/vim
    [alias]
    ; show merge tree + commits info
    graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
    lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
    ; basic logging for quick browsing
    ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate
    ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --numstat
    ; log + file diff
    fl = log -u
    ; find paths that matches the string
    f = "!git ls-files | grep -i"
    ; delete all merged branches
    ; dm = !git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
    ; shortcuts
    cp = cherry-pick
    st = status -s
    cl = clone
    ci = commit
    co = checkout
    br = branch
    dc = diff --cached
    ; show merge tree + commits info
    graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
    lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
    ; basic logging for quick browsing
    ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate
    ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --numstat
    ; log + file diff
    fl = log -u
    ; find paths that matches the string
    f = "!git ls-files | grep -i"
    ; delete all merged branches
    ; dm = !git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
    ; shortcuts
    cp = cherry-pick
    st = status -s
    cl = clone
    ci = commit
    co = checkout
    br = branch
    dc = diff --cached
    ```

    You will need to set the user name and email (removed from .gitconfig to avoid
    @@ -347,6 +420,7 @@ errors):
    ```sh
    git config --global user.name "Your Name Here"
    git config --global user.email [email protected]
    git config --global github.user yourGithubUserNameHere
    ```


    @@ -398,6 +472,10 @@ bind-key C-n next-window

    # enable mouse
    setw -g mouse on

    # set default shell to zsh
    set -g default-command /bin/zsh
    set -g default-shell /bin/zsh
    ```

    TODO: borrow tmux settings from [@ruyadorno](https://github.com/ruyadorno/installme-osx/)
    @@ -432,27 +510,4 @@ folders that you do not want to merge.
    `rsync` is great, you should use it when possible.


    ### 12. Download IE test VMs for VirtualBox

    these take a while to download! so maybe do it on a separate day as a
    background process...

    https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/


    ### 13. Download a base Ubuntu box for Vagrant

    I'm using [Vagrant](http://www.vagrantup.com/) to setup a few VMs locally for
    development.

    The Ubuntu image takes ~2h to download since vagrant server is slow (~50Kb/s),
    might be faster to download the iso from the [Ubuntu
    site](http://www.ubuntu.com/download/server) and mount the image by yourself.

    ```sh
    # Ubuntu Server 14.04
    vagrant box add ubuntu/trusty64
    ```


    ### 14. Profit!
    ### 12. Profit!
  4. @millermedeiros millermedeiros revised this gist Sep 12, 2018. 1 changed file with 7 additions and 0 deletions.
    7 changes: 7 additions & 0 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -354,6 +354,13 @@ git config --global user.email [email protected]

    [my .vimrc is on this gist](https://gist.github.com/millermedeiros/1262085).

    ```sh
    # create symlink to my vimrc file
    ln -s ~/Dropbox/dotfiles/vimrc ~/.vimrc
    # install Vundle to manage my plugins (https://github.com/VundleVim/Vundle.vim)
    git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
    ```


    ### 9. Create/Update `~/.tmux.config`

  5. @millermedeiros millermedeiros revised this gist Sep 12, 2018. 1 changed file with 3 additions and 4 deletions.
    7 changes: 3 additions & 4 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -1,8 +1,7 @@
    Setup Mac OS X Mountain Lion or Mavericks
    =========================================
    Setup Mac OS X
    ==============

    **Edit:** I few months ago I got a new laptop and did the same thing on
    Mavericks.
    **Edit:** I've done the same process every couple years since 2013 (Mountain Lion, Mavericks and High Sierra).

    I just replaced the hard drive of my mbp and decided to do a clean install of
    Mountain Lion (10.8.5) since I was still using Snow Leopard (10.6.8).
  6. @millermedeiros millermedeiros revised this gist Sep 12, 2018. 1 changed file with 73 additions and 40 deletions.
    113 changes: 73 additions & 40 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -25,6 +25,8 @@ Make sure everything is up to date.

    ### 2. Install Xcode and/or "Command Line Tools"

    > NOTE: homebrew now automatically installs command line tools, so you can skip this step.
    "Command Line Tools" can be downloaded separate from Xcode at
    https://developer.apple.com/downloads/ - It is way smaller than installing the
    whole Xcode but might not work for all cases tho.
    @@ -34,13 +36,13 @@ Xcode can be found on App Store. **preferred**
    More info on [how to download Command Line Tools inside XCode can be found on StackOverflow](http://stackoverflow.com/questions/9329243/xcode-4-4-and-later-install-command-line-tools)


    ### 3. Install homebrew and CLI tools
    ### 3. Install homebrew and other CLI tools

    http://brew.sh/

    ```sh
    # install homebrew
    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

    brew install git
    brew install node
    @@ -49,11 +51,16 @@ brew install z
    brew install ag
    brew install ack
    brew install ffind
    brew install fpp
    brew install tmux
    brew install watchman
    brew install yarn

    npm install -g gh-markdown-cli
    npm install -g ipt
    npm install -g http-server
    npm install -g jshint
    npm install -g esformatter
    npm install -g prettier
    npm install -g eslint
    # yeah, haters gonna hate
    npm install -g replace
    ```
    @@ -69,23 +76,16 @@ Many softwares can be installed through
    process way simpler:

    ```sh
    # install homebrew-cask
    brew install caskroom/cask/brew-cask

    # essential
    brew cask install adium
    brew cask install caffeine
    brew cask install dropbox
    brew cask install one-password
    brew cask install 1password
    brew cask install sensiblesidebuttons

    # dev
    brew cask install charles
    brew cask install cornerstone
    brew cask install filezilla
    brew cask install imagealpha
    brew cask install imageoptim
    brew cask install iterm2
    brew cask install livereload
    brew cask install macvim
    brew cask install sequel-pro
    brew cask install virtualbox
    @@ -94,7 +94,6 @@ brew cask install vagrant
    # utils
    brew cask install divvy
    brew cask install istat-menus
    brew cask install notational-velocity
    brew cask install the-unarchiver
    brew cask install vlc

    @@ -106,15 +105,15 @@ brew cask install google-chrome
    brew cask install limechat
    brew cask install skype
    brew cask install rightzoom
    brew cask install u-torrent

    # quick look plugins (https://github.com/sindresorhus/quick-look-plugins)
    brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package
    brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlimagesize webpquicklook suspicious-package quicklookase qlvideo
    ```

    #### App Store

    - TweetDeck
    - [Gifski](https://gif.ski/) (convert video into high-quality Gifs)
    - [Amphetamine](https://itunes.apple.com/us/app/amphetamine/id937984704?mt=12) (prevent mac from sleeping)

    #### Manually

    @@ -214,8 +213,8 @@ defaults write com.apple.spotlight orderedItems -array \
    '{"enabled" = 1;"name" = "APPLICATIONS";}' \
    '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
    '{"enabled" = 1;"name" = "DIRECTORIES";}' \
    '{"enabled" = 1;"name" = "PDF";}' \
    '{"enabled" = 1;"name" = "FONTS";}' \
    '{"enabled" = 0;"name" = "PDF";}' \
    '{"enabled" = 0;"name" = "FONTS";}' \
    '{"enabled" = 0;"name" = "DOCUMENTS";}' \
    '{"enabled" = 0;"name" = "MESSAGES";}' \
    '{"enabled" = 0;"name" = "CONTACT";}' \
    @@ -235,7 +234,7 @@ sudo mdutil -i on /
    sudo mdutil -E /
    ```

    source: https://github.com/mathiasbynens/dotfiles/blob/master/.osx
    source: https://github.com/mathiasbynens/dotfiles/blob/master/.macos



    @@ -253,6 +252,11 @@ alias gvim="/Applications/MacVim.app/Contents/MacOS/Vim -g"
    alias g="gvim --remote-silent"
    alias cask="brew cask"

    alias ipt-lg="git log --pretty=format:'%h | %<(80)%s | %<(12)%cr | %<(20)%an | %d' -15 | ipt --size 15 | sed 's#^[^0-9a-z]*\([0-9a-z]*\).*#\1#' | xargs git checkout"
    alias ipt-branch="git branch | ipt | xargs git checkout"
    alias ipt-vim="ipt -pm | xargs -o vim"
    alias ipt-gvim="ipt -pm | xargs -o gvim --remote-silent"

    # https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
    if [ -f ~/.bash/git-completion.sh ]; then
    source ~/.bash/git-completion.sh
    @@ -347,13 +351,53 @@ git config --global user.email [email protected]
    ```



    ### 8. Config vim

    [my .vimrc is on this gist](https://gist.github.com/millermedeiros/1262085).


    ### 9. Configure npm and generate SSH keys for github
    ### 9. Create/Update `~/.tmux.config`


    ```sh
    # Smart pane switching with awareness of Vim splits.
    # See: https://github.com/christoomey/vim-tmux-navigator
    is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
    | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
    bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
    bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
    bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
    bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
    bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
    bind-key -T copy-mode-vi C-h select-pane -L
    bind-key -T copy-mode-vi C-j select-pane -D
    bind-key -T copy-mode-vi C-k select-pane -U
    bind-key -T copy-mode-vi C-l select-pane -R
    bind-key -T copy-mode-vi C-\ select-pane -l

    # refresh 'status-left' and 'status-right' more often
    set-option -g status-interval 5

    # increase scrollback buffer size
    set-option -g history-limit 50000

    # address vim mode switching delay (http://superuser.com/a/252717/65504)
    set-option -s escape-time 0

    # focus events enabled for terminals that support them
    set-option -g focus-events on

    bind-key C-p previous-window
    bind-key C-n next-window

    # enable mouse
    setw -g mouse on
    ```

    TODO: borrow tmux settings from [@ruyadorno](https://github.com/ruyadorno/installme-osx/)


    ### 10. Configure npm and generate SSH keys for github

    Need to set the npm user:

    @@ -365,7 +409,7 @@ And also [generate SSH keys for github](https://help.github.com/articles/generat



    ### 10. Copy stuff from old HD
    ### 11. Copy stuff from old HD

    ```sh
    # recursively copy files and folders
    @@ -382,26 +426,15 @@ folders that you do not want to merge.
    `rsync` is great, you should use it when possible.


    ### 11. Download IE test VMs for VirtualBox
    ### 12. Download IE test VMs for VirtualBox

    these take a while to download! so maybe do it on a separate day as a
    background process...

    http://www.modern.ie/en-us/virtualization-tools

    ```sh
    # IE8 XP
    curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE8_XP/IE8.XP.For.MacVirtualBox.ova"

    # IE9 Win7
    curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE9_Win7/IE9.Win7.For.MacVirtualBox.part{1.sfx,2.rar,3.rar,4.rar,5.rar}"

    # IE10 Win8
    curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE10_Win8/IE10.Win8.For.MacVirtualBox.part{1.sfx,2.rar,3.rar}"
    ```
    https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/


    ### 12. Download a base Ubuntu box for Vagrant
    ### 13. Download a base Ubuntu box for Vagrant

    I'm using [Vagrant](http://www.vagrantup.com/) to setup a few VMs locally for
    development.
    @@ -411,9 +444,9 @@ might be faster to download the iso from the [Ubuntu
    site](http://www.ubuntu.com/download/server) and mount the image by yourself.

    ```sh
    # Ubuntu 12.04 LTS 64-bits
    vagrant box add precise64 http://files.vagrantup.com/precise64.box
    # Ubuntu Server 14.04
    vagrant box add ubuntu/trusty64
    ```


    ### 13. Profit!
    ### 14. Profit!
  7. @millermedeiros millermedeiros revised this gist Nov 26, 2015. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -70,8 +70,7 @@ process way simpler:

    ```sh
    # install homebrew-cask
    brew tap phinze/homebrew-cask
    brew install brew-cask
    brew install caskroom/cask/brew-cask

    # essential
    brew cask install adium
    @@ -110,7 +109,7 @@ brew cask install rightzoom
    brew cask install u-torrent

    # quick look plugins (https://github.com/sindresorhus/quick-look-plugins)
    brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql webp-quicklook suspicious-package && qlmanage -r
    brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql qlimagesize webpquicklook suspicious-package
    ```

    #### App Store
    @@ -269,6 +268,7 @@ if [ -f ~/.bash/prompt.sh ]; then
    source ~/.bash/prompt.sh
    fi

    # enable the "z" command
    . `brew --prefix`/etc/profile.d/z.sh
    ```

  8. @millermedeiros millermedeiros revised this gist Oct 13, 2015. No changes.
  9. @millermedeiros millermedeiros revised this gist Oct 13, 2015. 1 changed file with 2 additions and 13 deletions.
    15 changes: 2 additions & 13 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -106,7 +106,7 @@ brew cask install google-chrome
    # others
    brew cask install limechat
    brew cask install skype
    brew cask install right-zoom
    brew cask install rightzoom
    brew cask install u-torrent

    # quick look plugins (https://github.com/sindresorhus/quick-look-plugins)
    @@ -350,18 +350,7 @@ git config --global user.email [email protected]

    ### 8. Config vim

    I keep [my settings](https://gist.github.com/millermedeiros/1262085) and
    bundles on dropbox, just need to create the symlinks.

    ```sh
    # symlink DropBox files
    ln -s ~/Dropbox/vim/vim ~/.vim
    ln -s ~/Dropbox/vim/vimrc ~/.vimrc
    ln -s ~/Dropbox/vim/gvimrc ~/.gvimrc
    ```

    Might change this in the future to use a git repository tho.

    [my .vimrc is on this gist](https://gist.github.com/millermedeiros/1262085).


    ### 9. Configure npm and generate SSH keys for github
  10. @millermedeiros millermedeiros revised this gist Jun 3, 2014. 1 changed file with 5 additions and 2 deletions.
    7 changes: 5 additions & 2 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,8 @@
    Setup Mac OS X Mountain Lion
    ============================
    Setup Mac OS X Mountain Lion or Mavericks
    =========================================

    **Edit:** I few months ago I got a new laptop and did the same thing on
    Mavericks.

    I just replaced the hard drive of my mbp and decided to do a clean install of
    Mountain Lion (10.8.5) since I was still using Snow Leopard (10.6.8).
  11. @millermedeiros millermedeiros revised this gist Jan 6, 2014. 1 changed file with 2 additions and 1 deletion.
    3 changes: 2 additions & 1 deletion osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -26,8 +26,9 @@ Make sure everything is up to date.
    https://developer.apple.com/downloads/ - It is way smaller than installing the
    whole Xcode but might not work for all cases tho.

    Xcode can be found on App Store.
    Xcode can be found on App Store. **preferred**

    More info on [how to download Command Line Tools inside XCode can be found on StackOverflow](http://stackoverflow.com/questions/9329243/xcode-4-4-and-later-install-command-line-tools)


    ### 3. Install homebrew and CLI tools
  12. @millermedeiros millermedeiros revised this gist Jan 6, 2014. 1 changed file with 17 additions and 24 deletions.
    41 changes: 17 additions & 24 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -49,6 +49,7 @@ brew install ffind
    npm install -g gh-markdown-cli
    npm install -g http-server
    npm install -g jshint
    npm install -g esformatter
    # yeah, haters gonna hate
    npm install -g replace
    ```
    @@ -96,14 +97,16 @@ brew cask install vlc

    # browsers
    brew cask install firefox
    brew cask install firefox-aurora
    brew cask install google-chrome
    brew cask install google-chrome-canary

    # others
    brew cask install lime-chat
    brew cask install limechat
    brew cask install skype
    brew cask install right-zoom
    brew cask install u-torrent

    # quick look plugins (https://github.com/sindresorhus/quick-look-plugins)
    brew cask install qlcolorcode qlstephen qlmarkdown quicklook-json qlprettypatch quicklook-csv betterzipql webp-quicklook suspicious-package && qlmanage -r
    ```

    #### App Store
    @@ -113,23 +116,13 @@ brew cask install u-torrent
    #### Manually

    - [Backblaze](www.backblaze.com)
    - [RightZoom](https://www.macupdate.com/rightzoom)
    - [Firefox Nightly](http://nightly.mozilla.org/)
    - [Chrome Canary](https://www.google.com/intl/en/chrome/browser/canary.html) ([how to set canary as default browser](http://aaltonen.co/2011/05/06/make-chrome-canary-the-default-browser-on-mac-os-x/))
    - Adobe Suite (Photoshop, Illustrator, ...)



    ### 5. Set chrome canary as default browser

    1. Launch Safari
    2. Apple -> Preferences
    3. General -> Default Web Browser
    4. Select “Chrome Canary” from the drop-down menu

    source: http://aaltonen.co/2011/05/06/make-chrome-canary-the-default-browser-on-mac-os-x/



    ### 6. Borrow a few OSX settings from [mathiasbynens dotfiles](https://github.com/mathiasbynens/dotfiles)
    ### 5. Borrow a few OSX settings from [mathiasbynens dotfiles](https://github.com/mathiasbynens/dotfiles)


    ```sh
    @@ -243,7 +236,7 @@ source: https://github.com/mathiasbynens/dotfiles/blob/master/.osx



    ### 7. Create/Update `~/.bash_profile`
    ### 6. Create/Update `~/.bash_profile`

    ```sh
    export PS1='\w \$ '
    @@ -276,7 +269,7 @@ fi
    ```


    ### 8. Create/Update `~/.gitconfig`
    ### 7. Create/Update `~/.gitconfig`

    ```gitconfig
    ; I removed the [user] block on purpose so other people don't copy it by mistake
    @@ -351,7 +344,7 @@ git config --global user.email [email protected]



    ### 9. Config vim
    ### 8. Config vim

    I keep [my settings](https://gist.github.com/millermedeiros/1262085) and
    bundles on dropbox, just need to create the symlinks.
    @@ -367,7 +360,7 @@ Might change this in the future to use a git repository tho.



    ### 10. Configure npm and generate SSH keys for github
    ### 9. Configure npm and generate SSH keys for github

    Need to set the npm user:

    @@ -379,7 +372,7 @@ And also [generate SSH keys for github](https://help.github.com/articles/generat



    ### 11. Copy stuff from old HD
    ### 10. Copy stuff from old HD

    ```sh
    # recursively copy files and folders
    @@ -396,7 +389,7 @@ folders that you do not want to merge.
    `rsync` is great, you should use it when possible.


    ### 12. Download IE test VMs for VirtualBox
    ### 11. Download IE test VMs for VirtualBox

    these take a while to download! so maybe do it on a separate day as a
    background process...
    @@ -415,7 +408,7 @@ curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE10_Wi
    ```


    ### 13. Download a base Ubuntu box for Vagrant
    ### 12. Download a base Ubuntu box for Vagrant

    I'm using [Vagrant](http://www.vagrantup.com/) to setup a few VMs locally for
    development.
    @@ -430,4 +423,4 @@ vagrant box add precise64 http://files.vagrantup.com/precise64.box
    ```


    ### 14. Profit!
    ### 13. Profit!
  13. @millermedeiros millermedeiros revised this gist Oct 14, 2013. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -300,6 +300,10 @@ fi
    untracked = cyan
    [merge]
    log = true
    [push]
    ; "simple" avoid headaches, specially if you use `--force` w/o specifying branch
    ; see: http://stackoverflow.com/questions/13148066/warning-push-default-is-unset-its-implicit-value-is-changing-in-git-2-0
    default = simple
    [url "git://github.com/"]
    insteadOf = "github:"
    [url "[email protected]:"]
  14. @millermedeiros millermedeiros revised this gist Sep 27, 2013. 1 changed file with 22 additions and 3 deletions.
    25 changes: 22 additions & 3 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -76,6 +76,7 @@ brew cask install one-password

    # dev
    brew cask install charles
    brew cask install cornerstone
    brew cask install filezilla
    brew cask install imagealpha
    brew cask install imageoptim
    @@ -84,6 +85,7 @@ brew cask install livereload
    brew cask install macvim
    brew cask install sequel-pro
    brew cask install virtualbox
    brew cask install vagrant

    # utils
    brew cask install divvy
    @@ -376,8 +378,11 @@ And also [generate SSH keys for github](https://help.github.com/articles/generat
    ### 11. Copy stuff from old HD

    ```sh
    rsync -avC '/Volumes/Macintosh HD/Users/millermedeiros/Projects' ~/tmp_projects
    rsync -avC '/Volumes/Macintosh HD/Users/millermedeiros/Music/iTunes/iTunes Media' ~/tmp_music
    # recursively copy files and folders
    # beware of rsync `-C, --cvs-exclude` flag since it might exclude files you
    # don't want to like *.exe, core, tags...
    rsync -av '/Volumes/Macintosh HD/Users/millermedeiros/Projects' ~/tmp_projects
    rsync -av '/Volumes/Macintosh HD/Users/millermedeiros/Music/iTunes/iTunes Media' ~/tmp_music
    ```

    Check if files were copied properly and rename/move. Copying to a temporary
    @@ -406,5 +411,19 @@ curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE10_Wi
    ```


    ### 13. Profit!
    ### 13. Download a base Ubuntu box for Vagrant

    I'm using [Vagrant](http://www.vagrantup.com/) to setup a few VMs locally for
    development.

    The Ubuntu image takes ~2h to download since vagrant server is slow (~50Kb/s),
    might be faster to download the iso from the [Ubuntu
    site](http://www.ubuntu.com/download/server) and mount the image by yourself.

    ```sh
    # Ubuntu 12.04 LTS 64-bits
    vagrant box add precise64 http://files.vagrantup.com/precise64.box
    ```


    ### 14. Profit!
  15. @millermedeiros millermedeiros revised this gist Sep 23, 2013. 1 changed file with 29 additions and 15 deletions.
    44 changes: 29 additions & 15 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -9,7 +9,7 @@ process, but TBH I have this laptop for almost 3yrs and this is the first
    time I needed to reinstall everything, maybe the next time...

    This gist is just a personal reference in case I need to do it all over again.
    **I'm by no means an OSX expert, use this with care.**
    **I'm by no means an OSX/*nix expert, use with care.**


    Setup
    @@ -38,7 +38,6 @@ http://brew.sh/
    # install homebrew
    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

    # install tools that I use
    brew install git
    brew install node
    brew install wget
    @@ -47,6 +46,9 @@ brew install ag
    brew install ack
    brew install ffind

    npm install -g gh-markdown-cli
    npm install -g http-server
    npm install -g jshint
    # yeah, haters gonna hate
    npm install -g replace
    ```
    @@ -62,36 +64,43 @@ Many softwares can be installed through
    process way simpler:

    ```sh
    # install homebrew-cask
    brew tap phinze/homebrew-cask
    brew install brew-cask

    # essential
    brew cask install dropbox
    brew cask install one-password
    brew cask install adium
    brew cask install caffeine
    brew cask install dropbox
    brew cask install one-password

    # dev
    brew cask install charles
    brew cask install filezilla
    brew cask install imagealpha
    brew cask install imageoptim
    brew cask install iterm2
    brew cask install livereload
    brew cask install macvim
    brew cask install sequel-pro
    brew cask install virtualbox

    # utils
    brew cask install charles
    brew cask install filezilla
    brew cask install divvy
    brew cask install lime-chat
    brew cask install livereload
    brew cask install istat-menus
    brew cask install notational-velocity
    brew cask install sequel-pro
    brew cask install the-unarchiver
    brew cask install vlc

    # browsers
    brew cask install firefox
    brew cask install firefox-aurora
    brew cask install google-chrome
    brew cask install google-chrome-canary

    # others
    brew cask install imagealpha
    brew cask install imageoptim
    brew cask install virtualbox
    brew cask install lime-chat
    brew cask install skype
    brew cask install u-torrent
    ```

    @@ -244,6 +253,7 @@ export NODE_PATH="/usr/local/lib/node_modules:$NODE_PATH"

    alias gvim="/Applications/MacVim.app/Contents/MacOS/Vim -g"
    alias g="gvim --remote-silent"
    alias cask="brew cask"

    # https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
    if [ -f ~/.bash/git-completion.sh ]; then
    @@ -300,6 +310,8 @@ fi
    insteadOf = "mout:"
    [core]
    excludesfile = ~/.gitignore_global
    ; setting the editor fixes git commit bug http://tooky.co.uk/2010/04/08/there-was-a-problem-with-the-editor-vi-git-on-mac-os-x.html
    editor = /usr/bin/vim
    [alias]
    ; show merge tree + commits info
    graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
    @@ -363,14 +375,16 @@ And also [generate SSH keys for github](https://help.github.com/articles/generat

    ### 11. Copy stuff from old HD

    `rsync` is great, you should use it when possible.

    ```sh
    rsync -avC '/Volumes/Macintosh HD/Users/millermedeiros/Projects' ~/tmp_projects
    rsync -avC '/Volumes/Macintosh HD/Users/millermedeiros/Music/iTunes/iTunes Media' ~/tmp_music
    ```

    Check if files were copied properly and rename/move.
    Check if files were copied properly and rename/move. Copying to a temporary
    folder since `rsync` might delete files depending on the options and/or merge
    folders that you do not want to merge.

    `rsync` is great, you should use it when possible.


    ### 12. Download IE test VMs for VirtualBox
  16. @millermedeiros millermedeiros revised this gist Sep 18, 2013. 1 changed file with 21 additions and 19 deletions.
    40 changes: 21 additions & 19 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -118,23 +118,7 @@ source: http://aaltonen.co/2011/05/06/make-chrome-canary-the-default-browser-on-



    ### 6. Config vim

    I keep [my settings](https://gist.github.com/millermedeiros/1262085) and
    bundles on dropbox, just need to create the symlinks.

    ```sh
    # symlink DropBox files
    ln -s ~/Dropbox/vim/vim ~/.vim
    ln -s ~/Dropbox/vim/vimrc ~/.vimrc
    ln -s ~/Dropbox/vim/gvimrc ~/.gvimrc
    ```

    Might change this in the future to use a git repository tho.



    ### 7. Borrow a few OSX settings from [mathiasbynens dotfiles](https://github.com/mathiasbynens/dotfiles)
    ### 6. Borrow a few OSX settings from [mathiasbynens dotfiles](https://github.com/mathiasbynens/dotfiles)


    ```sh
    @@ -248,7 +232,7 @@ source: https://github.com/mathiasbynens/dotfiles/blob/master/.osx



    ### 8. Create/Update `~/.bash_profile`
    ### 7. Create/Update `~/.bash_profile`

    ```sh
    export PS1='\w \$ '
    @@ -280,7 +264,7 @@ fi
    ```


    ### 9. Create/Update `~/.gitconfig`
    ### 8. Create/Update `~/.gitconfig`

    ```gitconfig
    ; I removed the [user] block on purpose so other people don't copy it by mistake
    @@ -348,6 +332,23 @@ git config --global user.email [email protected]
    ```



    ### 9. Config vim

    I keep [my settings](https://gist.github.com/millermedeiros/1262085) and
    bundles on dropbox, just need to create the symlinks.

    ```sh
    # symlink DropBox files
    ln -s ~/Dropbox/vim/vim ~/.vim
    ln -s ~/Dropbox/vim/vimrc ~/.vimrc
    ln -s ~/Dropbox/vim/gvimrc ~/.gvimrc
    ```

    Might change this in the future to use a git repository tho.



    ### 10. Configure npm and generate SSH keys for github

    Need to set the npm user:
    @@ -392,3 +393,4 @@ curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE10_Wi


    ### 13. Profit!

  17. @millermedeiros millermedeiros revised this gist Sep 18, 2013. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -248,7 +248,7 @@ source: https://github.com/mathiasbynens/dotfiles/blob/master/.osx



    ### 8. Create/Update `.bash_profile`
    ### 8. Create/Update `~/.bash_profile`

    ```sh
    export PS1='\w \$ '
    @@ -280,7 +280,7 @@ fi
    ```


    ### 9. Create/Update `.gitconfig`
    ### 9. Create/Update `~/.gitconfig`

    ```gitconfig
    ; I removed the [user] block on purpose so other people don't copy it by mistake
  18. @millermedeiros millermedeiros created this gist Sep 18, 2013.
    394 changes: 394 additions & 0 deletions osx_setup.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,394 @@
    Setup Mac OS X Mountain Lion
    ============================

    I just replaced the hard drive of my mbp and decided to do a clean install of
    Mountain Lion (10.8.5) since I was still using Snow Leopard (10.6.8).

    I kinda regret for not using [Boxen](http://boxen.github.com/) to automate the
    process, but TBH I have this laptop for almost 3yrs and this is the first
    time I needed to reinstall everything, maybe the next time...

    This gist is just a personal reference in case I need to do it all over again.
    **I'm by no means an OSX expert, use this with care.**


    Setup
    -----

    ### 1. Run software update

    Make sure everything is up to date.


    ### 2. Install Xcode and/or "Command Line Tools"

    "Command Line Tools" can be downloaded separate from Xcode at
    https://developer.apple.com/downloads/ - It is way smaller than installing the
    whole Xcode but might not work for all cases tho.

    Xcode can be found on App Store.



    ### 3. Install homebrew and CLI tools

    http://brew.sh/

    ```sh
    # install homebrew
    ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

    # install tools that I use
    brew install git
    brew install node
    brew install wget
    brew install z
    brew install ag
    brew install ack
    brew install ffind

    # yeah, haters gonna hate
    npm install -g replace
    ```


    ### 4. Install softwares


    #### homebrew-cask

    Many softwares can be installed through
    [homebrew-cask](https://github.com/phinze/homebrew-cask) which makes the
    process way simpler:

    ```sh
    brew tap phinze/homebrew-cask
    brew install brew-cask

    # essential
    brew cask install dropbox
    brew cask install one-password
    brew cask install adium
    brew cask install caffeine
    brew cask install iterm2
    brew cask install macvim

    # utils
    brew cask install charles
    brew cask install filezilla
    brew cask install divvy
    brew cask install lime-chat
    brew cask install livereload
    brew cask install notational-velocity
    brew cask install sequel-pro
    brew cask install the-unarchiver
    brew cask install vlc

    # browsers
    brew cask install firefox-aurora
    brew cask install google-chrome-canary

    # others
    brew cask install imagealpha
    brew cask install imageoptim
    brew cask install virtualbox
    brew cask install u-torrent
    ```

    #### App Store

    - TweetDeck

    #### Manually

    - [Backblaze](www.backblaze.com)
    - [RightZoom](https://www.macupdate.com/rightzoom)
    - Adobe Suite (Photoshop, Illustrator, ...)



    ### 5. Set chrome canary as default browser

    1. Launch Safari
    2. Apple -> Preferences
    3. General -> Default Web Browser
    4. Select “Chrome Canary” from the drop-down menu

    source: http://aaltonen.co/2011/05/06/make-chrome-canary-the-default-browser-on-mac-os-x/



    ### 6. Config vim

    I keep [my settings](https://gist.github.com/millermedeiros/1262085) and
    bundles on dropbox, just need to create the symlinks.

    ```sh
    # symlink DropBox files
    ln -s ~/Dropbox/vim/vim ~/.vim
    ln -s ~/Dropbox/vim/vimrc ~/.vimrc
    ln -s ~/Dropbox/vim/gvimrc ~/.gvimrc
    ```

    Might change this in the future to use a git repository tho.



    ### 7. Borrow a few OSX settings from [mathiasbynens dotfiles](https://github.com/mathiasbynens/dotfiles)


    ```sh
    ###############################################################################
    # General UI/UX #
    ###############################################################################

    # Disable the sound effects on boot
    sudo nvram SystemAudioVolume=" "

    # Menu bar: show remaining battery time (on pre-10.8); hide percentage
    defaults write com.apple.menuextra.battery ShowPercent -string "NO"
    defaults write com.apple.menuextra.battery ShowTime -string "YES"


    ###############################################################################
    # Finder #
    ###############################################################################

    # Finder: show hidden files by default
    defaults write com.apple.finder AppleShowAllFiles -bool true

    # Finder: show all filename extensions
    defaults write NSGlobalDomain AppleShowAllExtensions -bool true

    # Finder: show status bar
    defaults write com.apple.finder ShowStatusBar -bool true

    # Finder: allow text selection in Quick Look
    defaults write com.apple.finder QLEnableTextSelection -bool true

    # Disable the warning when changing a file extension
    defaults write com.apple.finder FXEnableExtensionChangeWarning -bool false

    # Enable snap-to-grid for icons on the desktop and in other icon views
    /usr/libexec/PlistBuddy -c "Set :DesktopViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
    /usr/libexec/PlistBuddy -c "Set :FK_StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist
    /usr/libexec/PlistBuddy -c "Set :StandardViewSettings:IconViewSettings:arrangeBy grid" ~/Library/Preferences/com.apple.finder.plist


    ###############################################################################
    # Screen #
    ###############################################################################

    # Save screenshots to the desktop
    defaults write com.apple.screencapture location -string "$HOME/Desktop"

    # Save screenshots in PNG format (other options: BMP, GIF, JPG, PDF, TIFF)
    defaults write com.apple.screencapture type -string "png"

    # Disable shadow in screenshots
    defaults write com.apple.screencapture disable-shadow -bool true


    ###############################################################################
    # Address Book, Dashboard, iCal, TextEdit, and Disk Utility #
    ###############################################################################

    # Use plain text mode for new TextEdit documents
    defaults write com.apple.TextEdit RichText -int 0
    # Open and save files as UTF-8 in TextEdit
    defaults write com.apple.TextEdit PlainTextEncoding -int 4
    defaults write com.apple.TextEdit PlainTextEncodingForWrite -int 4


    ###############################################################################
    # Time Machine #
    ###############################################################################

    # Prevent Time Machine from prompting to use new hard drives as backup volume
    defaults write com.apple.TimeMachine DoNotOfferNewDisksForBackup -bool true


    ###############################################################################
    # Spotlight #
    ###############################################################################

    # Hide Spotlight tray-icon (and subsequent helper)
    #sudo chmod 600 /System/Library/CoreServices/Search.bundle/Contents/MacOS/Search
    # Disable Spotlight indexing for any volume that gets mounted and has not yet
    # been indexed before.
    # Use `sudo mdutil -i off "/Volumes/foo"` to stop indexing any volume.
    sudo defaults write /.Spotlight-V100/VolumeConfiguration Exclusions -array "/Volumes"
    # Change indexing order and disable some file types
    defaults write com.apple.spotlight orderedItems -array \
    '{"enabled" = 1;"name" = "APPLICATIONS";}' \
    '{"enabled" = 1;"name" = "SYSTEM_PREFS";}' \
    '{"enabled" = 1;"name" = "DIRECTORIES";}' \
    '{"enabled" = 1;"name" = "PDF";}' \
    '{"enabled" = 1;"name" = "FONTS";}' \
    '{"enabled" = 0;"name" = "DOCUMENTS";}' \
    '{"enabled" = 0;"name" = "MESSAGES";}' \
    '{"enabled" = 0;"name" = "CONTACT";}' \
    '{"enabled" = 0;"name" = "EVENT_TODO";}' \
    '{"enabled" = 0;"name" = "IMAGES";}' \
    '{"enabled" = 0;"name" = "BOOKMARKS";}' \
    '{"enabled" = 0;"name" = "MUSIC";}' \
    '{"enabled" = 0;"name" = "MOVIES";}' \
    '{"enabled" = 0;"name" = "PRESENTATIONS";}' \
    '{"enabled" = 0;"name" = "SPREADSHEETS";}' \
    '{"enabled" = 0;"name" = "SOURCE";}'
    # Load new settings before rebuilding the index
    killall mds
    # Make sure indexing is enabled for the main volume
    sudo mdutil -i on /
    # Rebuild the index from scratch
    sudo mdutil -E /
    ```

    source: https://github.com/mathiasbynens/dotfiles/blob/master/.osx



    ### 8. Create/Update `.bash_profile`

    ```sh
    export PS1='\w \$ '

    set -o vi

    export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
    export NODE_PATH="/usr/local/lib/node_modules:$NODE_PATH"

    alias gvim="/Applications/MacVim.app/Contents/MacOS/Vim -g"
    alias g="gvim --remote-silent"

    # https://github.com/git/git/blob/master/contrib/completion/git-completion.bash
    if [ -f ~/.bash/git-completion.sh ]; then
    source ~/.bash/git-completion.sh
    fi

    # `npm completion > ~/.bash/npm-completion.bash`
    if [ -f ~/.bash/npm-completion.sh ]; then
    source ~/.bash/npm-completion.sh
    fi

    # borrowed from http://petdance.com/2013/04/my-bash-prompt-with-gitsvn-branchstatus-display/
    if [ -f ~/.bash/prompt.sh ]; then
    source ~/.bash/prompt.sh
    fi

    . `brew --prefix`/etc/profile.d/z.sh
    ```


    ### 9. Create/Update `.gitconfig`

    ```gitconfig
    ; I removed the [user] block on purpose so other people don't copy it by mistake
    ; you will need to set these values
    [apply]
    whitespace = fix
    [color]
    ui = auto
    [color "branch"]
    current = yellow reverse
    local = yellow
    remote = green
    [color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
    [color "status"]
    added = yellow
    changed = green
    untracked = cyan
    [merge]
    log = true
    [url "git://github.com/"]
    insteadOf = "github:"
    [url "[email protected]:"]
    insteadOf = "gh:"
    pushInsteadOf = "github:"
    pushInsteadOf = "git://github.com/"
    [url "[email protected]:millermedeiros/"]
    insteadOf = "mm:"
    [url "[email protected]:mout/"]
    insteadOf = "mout:"
    [core]
    excludesfile = ~/.gitignore_global
    [alias]
    ; show merge tree + commits info
    graph = log --graph --date-order -C -M --pretty=format:\"<%h> %ad [%an] %Cgreen%d%Creset %s\" --all --date=short
    lg = log --graph --pretty=format:'%Cred%h%Creset %C(yellow)%an%d%Creset %s %Cgreen(%cr)%Creset' --date=relative
    ; basic logging for quick browsing
    ls = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate
    ll = log --pretty=format:"%C(yellow)%h%Cred%d\\ %Creset%s%Cgreen\\ [%cn]" --decorate --numstat
    ; log + file diff
    fl = log -u
    ; find paths that matches the string
    f = "!git ls-files | grep -i"
    ; delete all merged branches
    ; dm = !git branch --merged | grep -v "\*" | xargs -n 1 git branch -d
    ; shortcuts
    cp = cherry-pick
    st = status -s
    cl = clone
    ci = commit
    co = checkout
    br = branch
    dc = diff --cached
    ```

    You will need to set the user name and email (removed from .gitconfig to avoid
    errors):

    ```sh
    git config --global user.name "Your Name Here"
    git config --global user.email [email protected]
    ```


    ### 10. Configure npm and generate SSH keys for github

    Need to set the npm user:

    ```sh
    npm adduser
    ```

    And also [generate SSH keys for github](https://help.github.com/articles/generating-ssh-keys)



    ### 11. Copy stuff from old HD

    `rsync` is great, you should use it when possible.

    ```sh
    rsync -avC '/Volumes/Macintosh HD/Users/millermedeiros/Projects' ~/tmp_projects
    rsync -avC '/Volumes/Macintosh HD/Users/millermedeiros/Music/iTunes/iTunes Media' ~/tmp_music
    ```

    Check if files were copied properly and rename/move.


    ### 12. Download IE test VMs for VirtualBox

    these take a while to download! so maybe do it on a separate day as a
    background process...

    http://www.modern.ie/en-us/virtualization-tools

    ```sh
    # IE8 XP
    curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE8_XP/IE8.XP.For.MacVirtualBox.ova"

    # IE9 Win7
    curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE9_Win7/IE9.Win7.For.MacVirtualBox.part{1.sfx,2.rar,3.rar,4.rar,5.rar}"

    # IE10 Win8
    curl -O "https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/VirtualBox/OSX/IE10_Win8/IE10.Win8.For.MacVirtualBox.part{1.sfx,2.rar,3.rar}"
    ```


    ### 13. Profit!