Skip to content
OS X dotfiles: bash, git, vim, etc.
Find file
Pull request Compare This branch is 143 commits behind necolas:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


My OS X dotfiles.

Getting started


  • Git (1.7+)


This will create symlinks for most of the files and the vim directory. The .gitconfig file is copied to the HOME directory so that any private git configuration taking place is not accidentally committed.

It will also install various Homebrew formulae if Homebrew is already installed.

git clone git:// ~/.dotfiles
bash ~/.dotfiles/script/sync

N.B. This will overwrite any existing dotfiles in your HOME and .vim directories that have the same names as those found in this repository.


This must be done whenever you make a change to .gitconfig or pull from the remote repo.

bash ~/.dotfiles/script/sync

Custom OS X defaults

When setting up a new Mac, you may want to customise your OS X defaults after installing the dotfiles. The script to do so can be found in bin/osxdefaults, is added to the PATH, and can be executed by running:



The Homebrew update, formulae upgrade, and formulae installation is done automatically during installation (if Homebrew is already installed). It can also be carried out independently at any time by doing the following:

cd ~/.dotfiles
bash script/homebrew

If your Homebrew installation is not in usr/local then you must add your custom location's bin to your PATH in your .bash_profile.local:

# Add `brew` command's custom location to PATH

Adding local and private configurations

You can create a ~/.bash_profile.local file to add private and custom commands without the need to fork this repository. Any commands included in this file will not be under version control or committed to a public repository. If ~/.bash_profile.local exists, it will be sourced for inclusion in bash_profile.

Here is an example ~/.bash_profile.local:

# PATH exports
export PATH

# Git credentials
# Not under version control to prevent people from
# accidentally committing with your details
GIT_AUTHOR_NAME="Nicolas Gallagher"
# Set the credentials (modifies ~/.gitconfig)
git config --global "$GIT_AUTHOR_NAME"
git config --global "$GIT_AUTHOR_EMAIL"

Any special-case vim directives local to a machine should be stored in a .vimrc.local file on that machine. The directives will then be automatically imported into your master .vimrc.

Custom bash prompt

I use a custom bash prompt based on the Solarized color palette and influenced by @gf3's and @cowboy's custom prompts. Details are in the bash_prompt file.


Adding new git submodules

If you want to add more git submodules, e.g. vim plugins to be managed by pathogen, then follow these steps while in the root of the superproject.

# Add the new submodule
git submodule add git:// vim/bundle/one-submodule
# Initialize the submodule
git submodule init
# Clone the submodule
git submodule update
# Stage the changes
git add vim/bundle/one-submodule
# Commit the changes
git commit -m "Add a new submodule: one-submodule"

Updating git submodules

Updating individual submodules within the superproject:

# Change to the submodule directory
cd vim/bundle/one-submodule
# Checkout the desired branch (of the submodule)
git checkout master
# Pull from the tip of master (of the submodule - could be any sha or pointer)
git pull origin master
# Go back to main dotfiles repo root
cd ../../..
# Stage the submodule changes
git add vim/bundle/one-submodule
# Commit the submodule changes
git commit -m "Update submodule 'one-submodule' to the latest version"
# Push to a remote repository
git push origin master

Now, if anyone updates their local repository from the remote repository, then using git submodule update will update the submodules (that have been initialized) in their local repository. N.B This will wipe away any local changes made to those submodules.


Inspiration and code was taken from many sources, including:

Something went wrong with that request. Please try again.