Skip to content

From Shell Scripts

If you already have shell scripts that set up your machine, dotkit can improve them incrementally. You don’t need to rewrite everything at once.

  1. Run your scripts through dotkit

    Put your existing .sh files in a folder. Dotkit executes them as-is, no changes required:

    dotkit/
    personal.dotkit
    setup/
    install-tools.sh
    configure-git.sh
    configure-dock.sh
    personal.dotkit
    dotkit run setup
    Terminal window
    dotkit run ~/dotkit

    A folder with no dotkit file runs its .sh, .txt, and .md files alphabetically. You immediately get consistent order, --dry-run, and the bootstrap curl command.

    To control the order explicitly, name the files in the dotkit file instead:

    map dotkit run setup/{{item}}
    install-tools
    configure-git
    configure-dock
  2. Convert repeated commands to map blocks

    Before:

    Terminal window
    brew install gh
    brew install ripgrep
    brew install neovim
    brew install fzf

    After (.sh):

    Terminal window
    dotkit map 'brew install {{item}}' <<BODY
    gh
    ripgrep
    neovim
    fzf
    BODY

    Adding a new package is now one line. dotkit add packages/brew neovim handles both editing the file and running the install.

  3. Use community modules for common tools

    Replace boilerplate installer scripts with community modules:

    Terminal window
    dotkit map 'dotkit run :tools/{{item}}' <<BODY
    brew
    rust
    node-fnm
    BODY

A folder executes .sh, .txt, and .md files. Mix them freely:

packages/
brew.md ← dotkit format
mas.txt ← dotkit format
custom-tool.sh ← plain shell, runs as-is

Keep scripts you haven’t converted yet. They still run in the correct order.

Convert to .txt / .md when:

  • The script is mostly repeated commands (brew install, git config, mas install)
  • You want dotkit add to stay in sync as you install new things
  • The install has a clear “already installed?” check

Keep as .sh when:

  • The logic is complex (conditionals, loops, string manipulation)
  • It’s a one-off config script with no repetition
  • You want full shell control (complex error handling, subshells, etc.)