Skip to content

guw/dotfiles

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dotfiles

Gunnar's OS X & Linux (Ubuntu) dotfiles.

About this project

As with all the other similar repositories found on GitHub, this is my repository with common settings shared betwen Macs and Linux machines I use (currently only Ubuntu). It contains common settings, shell environments and utilities that easy my life on terminals.

There is one command called dotfiles, and this is my "dotfiles" Git repo.

How the "dotfiles" command works

When dotfiles is run for the first time, it does a few things:

  1. In Ubuntu, Git is installed if necessary via APT (it's already there in OSX).
  2. This repo is cloned into your user directory, under ~/.dotfiles.
  3. Files in /copy are copied into ~/. (read more)
  4. Files in /link are symlinked into ~/. (read more)
  5. You are prompted to choose scripts in /init to be executed. The installer attempts to only select relevant scripts, based on the detected OS and the script filename.
  6. Your chosen which init scripts are executed (in alphanumeric order, hence the funky names). (read more)

On subsequent runs, step 1 is skipped, step 2 just updates the already-existing repo, and step 5 remembers what you selected the last time. The other steps are the same.

Other subdirectories

  • The /backups directory gets created when necessary. Any files in ~/ that would have been overwritten by files in /copy or /link get backed up there.
  • The /bin directory contains executable shell scripts (including the dotfiles script) and symlinks to executable shell scripts. This directory is added to the path.
  • The /caches directory contains cached files, used by some scripts or functions.
  • The /conf directory just exists. If a config file doesn't need to go in ~/, reference it from the /conf directory.
  • The /bash directory contains files that are sourced whenever a new bash shell is opened (in alphanumeric order, hence the funky names).
  • The /test directory contains unit tests for especially complicated bash functions.
  • The /vendor directory contains third-party libraries.

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 ~/ with 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.

OS X

Ubuntu

Both

Installation

OS X Notes

You need to have XCode or, at the very minimum, the XCode Command Line Tools, which are available as a much smaller download.

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.15

Ubuntu Notes

You might want to set up your ubuntu server like I do it, but then again, you might not.

Either way, you should at least update/upgrade APT with sudo apt-get -qq update && sudo apt-get -qq dist-upgrade first.

Tested in Ubuntu 14.04 LTS

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.

Actual installation (for you)

  1. Read my gently-worded note
  2. Fork this repo
  3. Open a terminal/shell and do this:
export github_user=YOUR_GITHUB_USER_NAME

bash -c "$(curl -fsSL https://raw.github.com/$github_user/dotfiles/main/bin/dotfiles)" && source ~/.bashrc

Since you'll be using the dotfiles command on subsequent runs, you'll only have to export the github_user variable for the initial install.

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.

Actual installation (for me)

bash -c "$(curl -fsSL https://raw.githubusercontent.com/guw/dotfiles/main/bin/dotfiles)"

Aliases and Functions

To keep things easy, the ~/.bashrc and ~/.profile files are extremely simple, and should never need to be modified. Instead, add your aliases, functions, settings, etc into one of the files in the bash 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. My fancy prompt is based on Liquibase which shows things like git/svn repo and Mac battery/load status.

Private Exports

Should you ever want to create private exports, the ~/.profile file is intentionally not linked but copied. Feel free to add any sensitive export to that file.

Scripts

In addition to the aforementioned dotfiles script, there are a few other bin scripts.

  • dotfiles - (re)initialize dotfiles. It might ask for your password (for sudo).
  • src - (re)source all files in /bash directory
  • Look through the bin subdirectory for a few more.

Inspiration

https://github.com/cowboy/dotfiles

License

Copyright (c) 2015 Gunnar Wagenknecht and others. Licensed under the MIT license. Based on work by "Cowboy" Ben Alman (http://benalman.com/).

About

My dot files for OS X and Linux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published