My macOS dotfiles.
The installation step requires the XCode Command Line
Tools and may overwrite existing
dotfiles in your HOME and .vim directories.
$ bash -c "$(curl -fsSL https://raw.githubusercontent.com/necolas/dotfiles/master/bin/dotfiles)"N.B. If you wish to fork this project and maintain your own dotfiles, you must
substitute my username for your own in the above command and the 2 variables
found at the top of the bin/dotfiles script.
The installation script performs the following steps in order:
- Prompts for install location (defaults to
~/.dotfiles, or uses existing config) - Saves config to
~/.config/dotfiles/configfor future runs - Downloads the repository to your chosen location (if not already present)
- Installs Homebrew (if not already installed)
- Installs Git via Homebrew (if not already installed)
- Initializes a Git repository and connects it to the remote
- Syncs with the remote repository to get the latest changes
- Installs packages via Homebrew
- Creates symlinks from your home directory to the dotfiles:
~/.bash_profile→<dotfiles>/shell/bash_profile~/.inputrc→<dotfiles>/shell/inputrc~/.gitignore→<dotfiles>/git/gitignore~/.vim→<dotfiles>/vim
- Copies
<dotfiles>/git/gitconfigto~/.gitconfig(not symlinked to allow local git credentials) - Creates
~/.bash_profile.localfrom template (if it doesn't exist) - Applies macOS defaults (optional, with confirmation prompt)
On first run, the script will prompt you for an install location:
Where would you like to install dotfiles?
Install location [~/.dotfiles]: ~/Code/dotfiles
Press Enter to accept the default (~/.dotfiles) or enter a custom path.
The chosen location is saved to ~/.config/dotfiles/config and used for all
future runs.
You should run the update when:
- You make a change to
~/.dotfiles/git/gitconfig(the only file that is copied rather than symlinked). - You want to pull changes from the remote repository.
- You want to update Homebrew formulae.
Run the dotfiles command:
$ dotfilesOptions:
-h, --help |
Help |
-l, --link |
Quick update: symlinks only (skips sync, packages, macOS) |
--macos |
Apply macOS system settings only |
When making local changes to your dotfiles, use the quick update mode to apply changes without syncing or updating packages:
$ dotfiles --linkThis will update symlinks, copy gitconfig, and automatically reload your shell.
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.
Any private and custom Bash commands and configuration should be placed in the
~/.bash_profile.local file. 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.
N.B. Because the git/gitconfig file is copied to ~/.gitconfig, any private
git configuration specified in ~/.bash_profile.local will not be committed to
your dotfiles repository.
Homebrew formulae:
- GNU core utilities
- git
- git-delta (syntax-highlighting pager for git)
- bash-completion
- node
Custom macOS settings can be applied during the dotfiles process. They can
also be applied independently by running:
$ dotfiles --macosThese dotfiles include a script that uses rsync to incrementally back up your
data to an external, bootable clone of your computer's internal drive. First,
make sure that the value of DST in the bin/backup script matches the name
of your backup-drive. Then run the following command:
$ backupFor more information on how to setup your backup-drive, please read the preparatory steps in this post on creating a bootable macOS backup drive.
When your current working directory is a Git repository, the prompt will display the checked-out branch's name (and failing that, the commit SHA that HEAD is pointing to). The state of the working tree is reflected in the following way:
+ |
Uncommitted changes in the index |
! |
Unstaged changes |
? |
Untracked files |
$ |
Stashed files |
Further details are in the bash_prompt file.
Inspiration and code was taken from many sources, including:
- @mathiasbynens (Mathias Bynens) https://github.com/mathiasbynens/dotfiles
- @tejr (Tom Ryder) https://github.com/tejr/dotfiles
- @gf3 (Gianni Chiappetta) https://github.com/gf3/dotfiles
- @cowboy (Ben Alman) https://github.com/cowboy/dotfiles
- @alrra (Cãtãlin Mariş) https://github.com/alrra/dotfiles