This project contains the dotfiles and custom shell scripts that I use on my Mac.
Why keep them at GitHub? It’s a way to share advanced shell tips with other developers, and more practically, a way to back up my configuration. When I get a new Mac or (knock on wood) need to recover from lost data or a corrupt OS, I can simply clone this repository and immediately be back in business.
Before using these dotfiles there are a few things you'll need to install manually:
- Your Mac needs git and Apple’s command-line developer tools.
My blog post here has a walkthrough: https://mattbrictson.com/rails-osx-setup-guide
Sublime Text 3 settings and packages
For consistency with dotfiles for other apps, I put my Sublime Text 3 configuration in
~/.sublime. To ensure that Sublime Text can find this directory, I symlink
~/Library/Application Support/Sublime Text 3/Packages/User to it. The installation rake task (see below) takes care of setting this up for you. Here's what my dotfiles specify for Sublime:
- Settings optimized for Rails development
- Better auto-complete behavior
- Key bindings for clipboard history
- Improved key bindings for sidebar actions
- All Autocomplete
- Clipboard Manager
- Color Highlighter
- Indent XML
- Markdown Preview
- Pretty JSON
- Shell Command
- SSH Config
These scripts will be installed to
~/.bin and added to your
brew-installinstalls and updates my standard suite of homebrew recipes. Run it on a new machine after installing homebrew to get all the recipes needed for Rails development, node, PostgreSQL, etc.
bucketis a simple command-line interface for Bitbucket, most notably providing a way to create pull requests. Run
bucket --helpfor details.
defaults writeon OS X to change system default behavior to my liking: e.g. don't include drop-shadows on screenshots.
pluckcommand to git, which is a trick for cherry-picking a commit from another repository into the current one:
git pluck ../other-repo SHA.
reapcommand to git, which deletes local and remote branches that have already been merged with the master branch and thus are no longer needed.
ruby-installis a convenient wrapper around
rbenv installthat does some easy-to-forget housekeeping before and after installation. Usage:
supuses SSH to update packages on one or more Ubuntu servers (assuming you have root access to them). In other words,
sup SERVER1 SERVER2will SSH as root into both servers and run the appropriate
aptitudecommands to safely update all packages. It will also report whether any daemons need to be restarted for the updates to take effect.
Shell enhancements (bash)
- Customizes the shell prompt with current directory and git status: e.g.
~/Work/dotfiles (master *%)$.
lsoutput and adds
- Improves default
- Allows bash command history to be navigated with up and down arrow keys.
- Makes bash auto-completion case-insensitive.
- Sets up necessary homebrew, rbenv, and python virtualenv shell variables.
- Colorizes subversion output (for those legacy projects we all love!).
lessas the default pager and Sublime Text (
subl) as the default editor.
- Sets better defaults for the
- Sets up a reasonable global gitignore file to ignore things like
- Enables color output and line-ending checks.
- Shortens common commands:
- Defines somes useful aliases:
In addition, during installation (see below), you will be prompted for your full name and email address, which are automatically added to the git config file.
- Adds an
rcommand that serves as a shortcut for running
bin/rails. It's pretty smart, so
r swill expand to
bin/rails server, and
r dbwill expand to
bin/rake db:console. No more fat-finger mistakes of
- Disables gem documentation generation so that
gem installruns much faster.
- Sets PostgreSQL as the default database and disables Test::Unit by default (in favor of RSpec) when running
- Configures the
xraygem to use Sublime Text.
- Enables command history (use up and down arrows) in
- Defines a list of useful gems that are installed by default whenever a new version of ruby is installed via
Choose a place to store the dotfiles, like
git clone git://github.com/mattbrictson/dotfiles ~/Library/dotfiles cd ~/Library/dotfiles
Run one of the three installation options:
rake install:dotfiles # Install the dotfiles and scripts rake install:packages # Install homebrew packages and Mac defaults rake install # Install all of the above (recommended)
Changing your bash version
Some features of the dotfiles only work with bash version 4.2. After installing bash via homebrew (which
rake install:packages does for you), enable it as your shell as follows:
- Change your shell to