DEV Community

Cover image for A simple dotfiles utility you can use to bootstrap a new dev environment
Lewis Flude
Lewis Flude

Posted on

A simple dotfiles utility you can use to bootstrap a new dev environment

Get the dotfiles here: https://github.com/lewisflude/.dotfiles

Recently, I consolidated and simplified my config files for zsh, vim and tmux and created a simple shell script to symlink them to the home directory. Please feel free to fork, tweak and use yourself!

Get started by pulling down this repo to your home directory, cd in and run ./bootstrap.sh to begin the bootstrapping process.

This will install:

  • Brew
  • Zsh
  • Tmux
  • Nvm + latest version of node
  • Alacritty (ultra-fast terminal emulator)

After those are installed symlinks will be added for configs for zsh, vim, tmux and alacritty. You can edit these to your preferences, and they should automatically work!

Any feedback would also be massively appreciated!

Top comments (4)

Collapse
 
moopet profile image
Ben Sinclair

You can use one of several utilities to do the symlinking for you in a robust manner. I use GNU stow, personally. You're using ln -sf which will overwrite any existing files you have - you might not want that. Something like stow will warn you or refuse to run in that situation.

What you have is only going to work on Macs, but the good thing about dotfiles repos is that you can generalise them to work on any system you're setting up (I imagine you don't end up setting up your Mac that often, but VPSes and so on come and go).

I'd separate the concerns of installing software and supplying the default configuration. That way you can have a separate script for installing things which will work on other systems.

You check to see if brew is installed and install it if it isn't, but you don't do the same for other programs, like zplugin. I'd take that pattern and re-use it.

You can see how I do it in my dotfiles repo. But I don't always follow my own advice :)

Collapse
 
lewisflude profile image
Lewis Flude

Thanks! This is really specific and useful advice. stow seems like the sort of tool I've been looking for! Right now it's definitely macOS centric, and I think I might keep it that way.

Separating concerns sounds like a fantastic idea, and I think there's a tonne more optimisation that can be done to check what software already exists. I'll check out your dotfiles and may push some updates tomorrow!

Collapse
 
lewisflude profile image
Lewis Flude • Edited

I made a couple of those changes you suggested! github.com/lewisflude/.dotfiles

Now using stow, and checking everything! More to do, especially separating concerns a little! :)

Collapse
 
clayrisser profile image
Clay Risser

You should take a look at dotstow. It’s a tool built specifically for this purpose.

github.com/codejamninja/dotstow