Skip to content

🔧 .files, including ~/.macos — sensible hacker defaults for macOS

License

Notifications You must be signed in to change notification settings

NetCE/macos-dotfiles

 
 

Repository files navigation

dotfiles

Screenshot of my shell prompt

Installation

Using Git and the bootstrap script

You can clone the repository wherever you want. (I like to keep it in ~/code/dotfiles) The bootstrapper script will pull in the latest version and copy the files to your home folder.

git clone [email protected]:NetCE/macos-dotfiles.git && cd dotfiles && source bootstrap.sh

To update, cd into your local dotfiles repository and then:

source bootstrap.sh

Alternatively, to update while avoiding the confirmation prompt:

set -- -f; source bootstrap.sh

Git-free install

To install these dotfiles without Git:

https://github.com/NetCE/macos-dotfiles.git
cd; curl -#L https://github.com/NetCE/macos-dotfiles/tarball/main | tar -xzv --strip-components 1 --exclude={README.md,bootstrap.sh,.osx,LICENSE-MIT.txt}

To update later on, just run that command again.

Specify the $PATH

If ~/.path exists, it will be sourced along with the other files, before any feature testing (such as detecting which version of ls is being used) takes place.

Remember: Any time you think about updating .bash_profile or similar to modify your default paths, remember that it will be rewritten the next time you source dotfiles. Put path configuration into ~/.path instead, and then source your dotfiles.

Here’s an example ~/.path file that adds certain preferred keg-only brew installs to the $PATH:

# Set preferred versions of certain keg-only brew installs
PATH="/usr/local/opt/[email protected]/bin:$PATH"
PATH="/usr/local/opt/[email protected]/bin:$PATH"

Add custom commands without creating a new fork

If ~/.extra exists, it will be sourced along with the other files. You can use this to add a few custom commands without the need to fork this entire repository, or to add commands you don’t want to commit to a public repository.

Remember: Any time you think about updating .bash_profile or similar to add custom commands, remember that it will be rewritten the next time you source dotfiles. Put them into ~/.extra instead, and then source your dotfiles.

My ~/.extra looks something like this:

# Git configs
# Not in the repository, to prevent people from accidentally committing with these values
GIT_AUTHOR_NAME="Firstname Lastname"
GIT_AUTHOR_EMAIL="[email protected]"

GIT_COMMITTER_NAME="$GIT_AUTHOR_NAME"
GIT_COMMITTER_EMAIL="$GIT_AUTHOR_EMAIL"

git config --global user.name "$GIT_AUTHOR_NAME"
git config --global user.email "$GIT_AUTHOR_EMAIL"

git config --global commit.gpgsign false
git config --global pull.rebase true

echo 'eval "$(rbenv init -)"' >> ~/.bashrc

You could also use ~/.extra to override settings, functions and aliases from my dotfiles repository. It’s probably better to fork this repository instead, though.

Sensible macOS defaults

When setting up a new Mac, you may want to set some sensible macOS defaults:

./.macos

Install Homebrew formulae

When setting up a new Mac, you may want to install some common Homebrew formulae (after installing Homebrew, of course):

./brew.sh

Some of the functionality of these dotfiles depends on formulae installed by brew.sh. If you don’t plan to run brew.sh, you should look carefully through the script and manually install any particularly important ones. A good example is Bash/Git completion: the dotfiles use a special version from Homebrew.

Feedback

Suggestions/improvements welcome!

Author

twitter/mathias
Mathias Bynens

Thanks to…

About

🔧 .files, including ~/.macos — sensible hacker defaults for macOS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 56.8%
  • Vim Script 43.2%