7 ms·
Managing dotfiles with GNU Stow
- corybrown 11y agoI guess the automatic linking is nice, but I don't really see a need to switch vim configurations that often. What am I missing?
- LaFolle 11y ago"The problem was always with setting them up on new machine and update it when I need to."
- deleted 11y ago[deleted]
- herebolt 11y agoI like to use rcm[1] for this. Works very well for keeping my configuration synced between multiple machines (via git). [1] https://github.com/thoughtbot/rcm https://github.com/thoughtbot/rcm
- jaequery 11y agothis is a good find, i sorely need this!
- sooheon 11y agoI use yadm[1]. I don't have extensive experience with others, but I liked the idea of having my dotfiles in their original place, rather than inside a dedicated dotfiles folder. [1] https://github.com/TheLocehiliosan/yadm https://github.com/TheLocehiliosan/yadm
- jiiam 11y agoOh god, yes! Finally! I'm sick of hundreds of dotfiles forgotten in remote places of my filesystem, organized via a github repo and deployed with a handcrafted (by a friend) Rakefile. The only change I'd make is to deploy by copying (and not by symlinking).
- justinmk 11y ago"dotfiles managers" are over-engineered waste of time. You only need git. Create ~/.gitignore with a single line: * git tracks modifications to your dotfiles. And on the rare occasion that you need to add a new file, just force-add it: git add -f ~/.foorc If you need a script to "install" your dotfiles, you're doing it wrong.
- jiiam 11y agoThis seems like an astonishingly good idea. It maybe lacks features for my home computer, but would be good for throw away servers like those you get from DigitalOcean, where I systematically set up everything over and over again each time.
- corndoge 11y agoI fail to see how this comes with the convenience of directory-specific symbolic links, dotfile-specific backups, individual removal & replacement of dotfiles, etc etc. I've been using stow for years to manage my dotfiles and it's never been more involved than $ stow dotfiles/urxvt or what have you. In fact I would say that managing a git repository is more of a waste of time and far more over-engineered for a task easily solved by a tiny binary. Not sure what you're referring to by an 'install script', have you ever used stow? In any case, the real answer is that you should be using whatever works best for your use case, and for me that's stow.
- pmoriarty 11y agoThat does not work for me. When I try "stow foo/bar" I get this error: Undefined subroutine &main::error called at /usr/bin/stow line 568, <DATA> line 18. where line 568 of /usr/bin/stow is: error("Slashes are not permitted in package names"); What version of stow do you have? I'm using stow 2.2.0-r2 on Gentoo Linux.
- dbbolton 11y agoFrom the documentation page: >A package directory is the root of a tree containing the installation image for a particular package. Each package directory must reside in a stow directory — e.g., the package directory /usr/local/stow/perl must reside in the stow directory /usr/local/stow. The name of a package is the name of its directory within the stow directory — e.g., perl. https://www.gnu.org/software/stow/manual/stow.html https://www.gnu.org/software/stow/manual/stow.html The article in the OP also doesn't use this format. Instead it's prefaced with a `cd` command, so you would need to do: cd foo; stow bar
- Sir_Cmpwn 11y agoThe solution I eventually came to appreciate is to simply make your home directory a git repository.
- Pirate-of-SV 11y agoDo you remove all files from the directory before cloning or have you found some other way to get around "fatal: destination path '.' already exists and is not an empty directory."?
- Sir_Cmpwn 11y agogit init git remote add origin ... git fetch origin git checkout -t origin/master
- peterhajas 11y agoI've been managing my dotfiles with `stow` for the past ~2 years. It's super easy, and keeps things clean. `stow` will also guard against non-symlinks getting stomped on. My `update.sh` script does un-and-re-`stow`ing: https://github.com/peterhajas/dotfiles https://github.com/peterhajas/dotfiles
- elnappo 11y agoI use ansible to manage my dotfiles, configurations, cli and gui tools on OS X. https://github.com/elnappo/dotfiles https://github.com/elnappo/dotfiles
- muskalek 11y agoI'm using stow to manage my dotfiles since about a year, and it works pretty well. I tried things like homesick (or homeshick), but they were well overengineered and too complex for me. It also works great when you create git submodules for your external dependencies and manage installing them via stow.
- awinter-py 11y agohomesick is such a good name though
- gioele 11y agoAnd, in general, it would be better if there were fewer dotfiles in $HOME. Please application developers, follow the XDG Base Directory spec (or the equivalent in Windows and Mac OS X). See https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html https://specifications.freedesktop.org/basedir-spec/basedir-... and https://wiki.archlinux.org/index.php/XDG_Base_Directory_support https://wiki.archlinux.org/index.php/XDG_Base_Directory_supp...
- nextos 11y agoI'm torn about this. Some XDG-aware applications use a very convoluted sequence of subfolders to end up placing just a dotfile. Whereas classical Unix applications simply have one easy to identify dotfile in ~/.
- jxy 11y agoExactly so. What's the point of moving dot files / configuration files away from $HOME, but only end up having a complex directory structure that stores what you can already do with dot files? It may be subjective. I don't like the XDG specs. Have you peeked in to OS X $HOME/Library? That's what you end up having. (Let's not talk about windows registries, but I guess systemd people like it.) Is that any better than dot files under $HOME? Hardly so.
- johnny22 11y agoI prefer the xdg variables mostly for $XDG_CACHE_HOME and $XDG_RUNTIME_DIR. Those are the kinds of things I don't want to keep having to write rules to exclude from my backups.
- dbbolton 11y agoOne of the best zsh tweaks I've done was setting ZDOTDIR="${XDG_CONFIG_HOME}/zsh" in `/etc/zshrc`, then moving all miscellaneous files to the same place: # ~/.config/zsh/.zshenv export HISTFILE="${ZDOTDIR}/history" # ~/.config/.zshrc compinit -d ${ZDOTDIR}/zcompdump zstyle ':completion:*' cache-path "${ZDOTDIR}/cache" ## separate files for easier and quicker editing: for file in $ext_files; do [[ -f ${ZDOTDIR}/${file} ]] && source ${ZDOTDIR}/${file} done This method removed quite a few files (history, compdump, cache, zkbd, zshrc, zshenv, zprofile, zlogin, etc.) from my home dir. I'm sure bash has something similar, but like you said, it would be nice if programs didn't junk up $HOME by default.
- captn3m0 11y agoAnother happy stow user reporting in. Helps me a lot in managing my dotfiles across machines, and symlinking has been a huge improvement over rsync. Also, stow raises an error if it cannot symlink to the file (for eg, if a file/directory exists there with the same name somewhere in the path), so it is always non-destructive.
- espin 11y agoI use a detached work tree approach to version my dotfiles without having to symlink or install them, see http://enrico.spinielli.net/dotfiles/ http://enrico.spinielli.net/dotfiles/ for details.
- tacone 11y agopretty cool, thanks!
- ashitlerferad 11y agohttps://github.com/RichiH/vcsh https://github.com/RichiH/vcsh
- lolidaisuki 11y agoThis thread happens like every month. Developers sure spend a lot of time thinking about how they install their dotfiles.
- balthamos89 11y agoI've been using the "per-application" method (as the article calls it) for about 4 years now, and it's been working fantastically. Now if I could only figure out an equally good method for managing my ssh keys... A small tip for those working on locked-down systems: if you can't install GNU Stow, you can use XStow[1] instead. It is a C++ version of Stow (instead of Perl). It is very easy to build and has very few (if any) dependencies. [1]: http://xstow.sourceforge.net http://xstow.sourceforge.net
- ubercow 11y agoI'm quite fond of thoughtbot's rcm. https://github.com/thoughtbot/rcm https://github.com/thoughtbot/rcm
- _mikz 11y ago[2003]
- to3m 11y ago[2013]... it mentions GitHub...
- ralish 11y agoI've found Stow to be outstanding. When I initially started actually maintaining my dotfiles properly I looked at what others were doing based on public repositories and most at the time were either not using any sort of management tool (manual symlinking as needed) or using something written in a interpreted language that couldn't be assumed to be on a diverse range of Unix-like systems in default installations (e.g. Ruby, Python, Node.js, etc...). The problem was I wanted something I could easily install on effectively any system, including live servers, without needing to install dependencies or otherwise change the underlying global system state. Stow manages to solve this beautifully as pretty much all Unix-like systems do have a Perl interpreter and Stow has no unusual dependencies beyond the core runtime. That, and it can be included in your dotfiles collection itself, so you can literally "stow stow" to "bootstrap" itself and then carry along! If anyone's interested you can find my dotfiles below which may be nice as reference material if you're wanting to "stow-ify" your dotfiles. I've also written some Bash scripts to automatically stow the available components on a given system (dot-manage) and easily fetch updates from an upstream repository, re-run component detection and update Vim bundles via Vundle (dot-update). There's also a metadata-esque system which augments detection of which components are available for where simply checking if a binary named after the relevant folder exists on the system is insufficient (e.g. for libraries like readline). https://github.com/ralish/dotfiles https://github.com/ralish/dotfiles
- digi_owl 11y agoYou may want go take a look at Gobolinux. Its a distro that applies a similar system to package management.
- bluejekyll 11y agoI've seen many people accidentally upload secret keys to external repos because of things like this. I didn't see it in what I read (honestly I just breezed through it), does this prevent secret keys from being uploaded accidentally?
- dannysu 11y agoI was giving stow a try and was confused why it wasn't symlinking .gitignore. Turns out .gitignore is on the default ignore list. But you if you add a .stow-local-ignore file to the directory where your .gitignore is then it works.
- pmyjavec 11y agoI gave it a go but stow seems to be ignoring files that start with a dot. Uninstalled and stuck with my 5 line shell script.