A fork of cowboy/dotfiles focused on OS X.
dotfiles - A single command to "bootstrap" a new system to pull down all of my dotfiles and configs, as well as install all the tools I commonly use. In addition, I wanted to be able to re-execute that command at any time to synchronize anything that might have changed. Finally, I wanted to make it easy to re-integrate changes back in, so that other machines could be updated.
How the "dotfiles" command works
When dotfiles is run for the first time, it does a few things:
- This repo is cloned into your user directory, under
- Files in
/copyare copied into
~/. (read more)
- Files in
/linkare symlinked into
~/. (read more)
- You are prompted to choose scripts in
/initto be executed. The installer attempts to only select relevant scripts, based on the detected OS and the script filename.
- Your chosen init scripts are executed (in alphanumeric order, hence the funky names). (read more)
On subsequent runs, step 1 just updates the already-existing repo, and step 4 remembers what you selected the last time. The other steps are the same.
/backupsdirectory gets created when necessary. Any files in
~/that would have been overwritten by files in
/linkget backed up there.
/bindirectory contains executable shell scripts (including the dotfiles script) and symlinks to executable shell scripts. This directory is added to the path.
/cachesdirectory contains cached files, used by some scripts or functions.
/confdirectory just exists. If a config file doesn't need to go in
~/, reference it from the
/sourcedirectory contains files that are sourced whenever a new shell is opened (in alphanumeric order, hence the funky names).
/testdirectory contains unit tests for especially complicated bash functions.
The "copy" step
Any file in the
/copy subdirectory will be copied into
~/. Any file that needs to be modified with personal information (like copy/.gitconfig which contains an email address and private key) should be copied into
~/. Because the file you'll be editing is no longer in
~/.dotfiles, it's less likely to be accidentally committed into your public dotfiles repo.
The "link" step
Any file in the
/link subdirectory gets symlinked into
ln -s. Edit one or the other, and you change the file in both places. Don't link files containing sensitive data, or you might accidentally commit that data! If you're linking a directory that might contain sensitive data (like
~/.ssh) add the sensitive files to your .gitignore file!
The "init" step
Scripts in the
/init subdirectory will be executed. A whole bunch of things will be installed, but only if they aren't already.
- Minor XCode init via the init/10_osx_xcode.sh script
- Homebrew via the init/20_osx_homebrew.sh script
- Homebrew recipes via the init/21_osx_homebrew_recipes.sh script
- Homebrew casks via the init/22_osx_homebrew_casks.sh script
- Fonts via the init/25_osx_fonts.sh script
- Node.js, npm via the init/50_node.sh script
- Vim plugins via the init/50_vim.sh script
- Python, packages and pyenv via the init/60_python.sh and init/61_python_recipes.sh script
- Ruby, gems and rbenv via the init/70_ruby.sh and init/71_ruby_gems.sh script
Hacking my dotfiles
Because the dotfiles script is completely self-contained, you should be able to delete everything else from your dotfiles repo fork, and it will still work. The only thing it really cares about are the
/init subdirectories, which will be ignored if they are empty or don't exist.
Also, before installing, be sure to read Ben's gently-worded note.
The easiest way to install the XCode Command Line Tools in OSX 10.9+ is to open up a terminal, type
xcode-select --install and follow the prompts.
Tested in OSX 10.10
Heed this critically important warning before you install
If you're not me, please do not install dotfiles directly from this repo!
Why? Because I often completely break this repo while updating. Which means that if I do that and you run the
dotfiles command, your home directory will burst into flames, and you'll have to go buy a new computer. No, not really, but it will be very messy.
- Read Ben's gently-worded note
- Fork this repo
- Open a terminal/shell and do this:
export github_user=lexrus && bash -c "$(curl -fsSL https://raw.github.com/$github_user/dotfiles/master/bin/dotfiles)" && source ~/.zshrc
There's a lot of stuff that requires admin access via
sudo, so be warned that you might need to enter your password here or there.
Aliases and Functions
To keep things easy, add your aliases, functions, settings, etc into one of the files in the
source subdirectory, or add a new file. They're all automatically sourced when a new shell is opened. Take a look, I have a lot of aliases and functions.
- dotfiles - (re)initialize dotfiles. It might ask for your password (for
- src - (re)source all files in
- Look through the bin subdirectory for a few more.
Copyright (c) 2014 "Cowboy" Ben Alman
Licensed under the MIT license.