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 profile run folder. Dotkit executes them as-is (no changes required):

    profiles/personal/setup/
    install-tools.sh
    configure-git.sh
    configure-dock.sh
    Terminal window
    dotkit apply profiles/personal

    You immediately get: consistent execution order, dotkit apply --dry-run, and the bootstrap curl command. Use a wrapper script and put everything in a subfolder of setup/ to control execution order.

  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

Run folders execute .sh, .txt, and .md files. Mix them freely:

profiles/personal/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.)