Search code examples
configuration-filesmacos-sierrazshrchidden-filesdotfiles

Move All Dotfiles Out of Root Directory


I'm am running macOS Sierra, and am in the process of moving all dotfiles into one directory. I have successfully exported many environment variables for various installations (vagrant, composer, oh-my-zsh etc) that allow me to install to a sub-directory of my choice.

Unfortunately, programs like npm, subversion, homestead, git, and others do not offer such configurations.


Solution

  • I use a dotfiles repository, where I keep my configuration files under git. The idea is not new. What I did is move them to another directory and them create a symlink to them in the home directory. It does not clean the home directory as you wanted, since it's the standard place for configuration files, as stated by Norman Gray, but at least you can version them and share them across machines.

    Example:

    cd ~
    mkdir dotfiles
    mv .gitconfig dotfiles/.gitconfig
    ln -s ~/dotfiles/.gitconfig ~/.gitconfig