https://github.com/timopruesse/machine_setup
Manage your machine setup.
https://github.com/timopruesse/machine_setup
command-line-tool config configuration dotfiles environment setup setup-development-environment
Last synced: 19 days ago
JSON representation
Manage your machine setup.
- Host: GitHub
- URL: https://github.com/timopruesse/machine_setup
- Owner: timopruesse
- Created: 2022-03-13T23:22:30.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2026-04-07T20:24:41.000Z (19 days ago)
- Last Synced: 2026-04-07T20:26:44.619Z (19 days ago)
- Topics: command-line-tool, config, configuration, dotfiles, environment, setup, setup-development-environment
- Language: Rust
- Homepage:
- Size: 550 KB
- Stars: 17
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Machine Setup
[](https://github.com/timopruesse/machine_setup/actions/workflows/test.yml)
[](https://github.com/timopruesse/machine_setup/actions/workflows/build.yml)
[](https://crates.io/crates/machine_setup)
The idea is to be able to replicate a certain setup (when resetting your machine or using a completely new machine).
Additionally, it should be possible to update the setup easily when needed, e.g. an update to your vim config files.
So, it will help with managing dotfiles, symlinks, etc.
A real world example can be found in my [.dotfiles repository](https://github.com/timopruesse/.dotfiles/blob/main/machine_setup.yaml).
You can also use it for other tasks such as making the onboarding process of a new colleague easier by providing them a config that installs certain dependencies and checks out important repositories.
## What's New in v2
- **TUI Dashboard**: Real-time progress display with task list, per-task log output, and keyboard navigation. Powered by [ratatui](https://ratatui.rs/). Disable with `--no-tui` for CI environments.
- **Async Engine**: Task execution powered by [tokio](https://tokio.rs/) for proper concurrent I/O (file ops, git, shell commands with streaming output).
- **Task History**: Tracks install/update/uninstall timestamps in `~/.machine_setup/history.json`. Already-installed tasks are skipped unless `--force` is used.
- **PowerShell Support**: Use `powershell` as a shell option alongside `bash` and `zsh`.
- **Remote Configs**: Point directly at a URL instead of a local file — great for bootstrapping a clean machine without cloning first.
## Install
### Quick Install (no dependencies needed)
**macOS / Linux:**
```sh
curl -fsSL https://raw.githubusercontent.com/timopruesse/machine_setup/main/install/install.sh | sh
```
**Windows (PowerShell):**
```powershell
irm https://raw.githubusercontent.com/timopruesse/machine_setup/main/install/install.ps1 | iex
```
### Other methods
**Via Homebrew (macOS / Linux):**
```bash
brew install timopruesse/repo/machine_setup
```
**Via Cargo:**
```bash
cargo install machine_setup
```
**Manual download:** Grab a binary from the [release page](https://github.com/timopruesse/machine_setup/releases).
## Run
### Subcommands
| command | description | example |
| --------- | ----------------------------- | -------------------------- |
| install | install the defined tasks | `machine_setup install` |
| update | update the defined tasks | `machine_setup update` |
| uninstall | uninstall the defined tasks | `machine_setup uninstall` |
| list | list all of the defined tasks | `machine_setup list` |
By default, `machine_setup` will look for a file called `machine_setup` with a supported file format.
Supported file formats are: `yaml`, `yml`, and `json`.
### Command line parameters
| flag | value | example |
| ----------------- | ------------------------------------------------- | -------------------------------------------------- |
| -c
--config | path or URL to the config file | `machine_setup install -c ./config/my_setup.yaml` |
| -t
--task | only run the specified task | `machine_setup install -t my_task2` |
| -s
--select | select a task to run | `machine_setup install -s` |
| -f
--force | force execution (bypass history checks) | `machine_setup install --force` |
| --no-tui | disable TUI, use plain log output | `machine_setup install --no-tui` |
| -h
--help | display help information | `machine_setup --help` |
| -v
--version | display version information | `machine_setup --version` |
| -d
--debug | print additional debug information | `machine_setup install --debug` |
| -l
--level | set a log level (info, warn, error, debug, trace) | `machine_setup install --level=info` |
### Remote config files
You can pass a URL instead of a local path — the config is fetched and executed directly. GitHub blob URLs are automatically converted to raw URLs.
```bash
machine_setup install -c https://github.com/timopruesse/.dotfiles/blob/main/machine_setup.yaml
```
This is especially useful for setting up a fresh machine without cloning your dotfiles first:
```bash
# Install machine_setup
curl -fsSL https://raw.githubusercontent.com/timopruesse/machine_setup/main/install/install.sh | sh
# Run your dotfiles setup directly from GitHub
machine_setup install -c https://github.com/timopruesse/.dotfiles/blob/main/machine_setup.yaml
```
### TUI Dashboard
When running in an interactive terminal, a TUI dashboard is shown with:
- Task list with status indicators (pending, running, completed, failed, skipped)
- Per-task scrollable log output
- Progress bar with completion stats
- Keyboard navigation: `Up/Down` to navigate tasks, `PgUp/PgDn` to scroll logs, `q` to quit
The TUI is automatically disabled in non-interactive environments (piped output, CI). You can also explicitly disable it with `--no-tui`.
### Supported config file formats
The supported formats are `YAML` and `JSON`.
## Configure
Tasks can be defined under the `tasks` root key.
Every task can contain an arbitrary number of commands.
| key | description | values | default |
| ------------- | ---------------------------------------------------- | ---------------------------- | ---------------------------- |
| tasks | root key for all of the tasks | | |
| default_shell | shell that is used when not specified by the command | `bash`, `zsh`, `powershell` | `bash` |
| temp_dir | define where temporary files are stored | | `~/.machine_setup` |
| parallel | run all of the tasks in parallel | `true` or `false` | `false` |
| num_threads | number of threads when run in parallel | numeric > 1 | physical processor count - 1 |
### Task specific configuration
| key | description | values | examples |
| -------- | ---------------------------------------------------------- | ---------------------------------------------------------------------------- | ----------------------------- |
| os | only run on the specified os | [possible values](https://doc.rust-lang.org/std/env/consts/constant.OS.html) | "linux" or ["linux", "macos"] |
| parallel | run all of the commands in parallel (1 thread per command) | `true` or `false` | `false` |
Check out the example configuration below:
```yaml
temp_dir: "~/my_temp" # defaults to "~/.machine_setup"
default_shell: "zsh" # defaults to "bash"
parallel: true
num_threads: 2
tasks:
my_task1:
os: ["linux", "windows"]
parallel: true
commands:
- copy:
src: "./src/files"
target: "/tmp/target"
- copy:
src: "./src/files_2"
target: "/tmp/target"
my_task2:
os: ["linux"]
parallel: true
commands:
- run:
commands: "sudo apt-get install git -y"
- symlink:
src: "./src/config"
target: "~/.dotfiles"
```
### Extend a configuration
Extensibility is not explicitly built in.
However, it's possible to execute tasks from another configuration via the [machine_setup](#machine_setup) command.
### Available config commands
#### copy
This command copies the contents of a directory to another directory.
| argument | value | required | example |
| -------- | ----------------------------------- | :------: | -------------------------------------- |
| src | source directory/file | Y | "./src/files" or "./src/test.txt" |
| target | target directory/file | Y | "/tmp/target" or "/tmp/target/new.txt" |
| ignore | list of files/directories to ignore | - | ["dist", "package-lock.json"] |
| sudo | run file operations with sudo | - | true |
##### example
```yaml
copy:
src: "./src/files"
target: "/tmp/target"
ignore: ["dist", "package-lock.json"]
# Copy to a protected path
copy:
src: "./etc/wsl.conf"
target: "/etc/wsl.conf"
sudo: true
```
#### clone
This command clones a git repository to the specified destination.
| argument | value | required | example |
| -------- | ----------------------- | :------: | ---------------------------------------------- |
| url | URL to a git repository | Y | "git@github.com:timopruesse/machine_setup.git" |
| target | target directory | Y | "~/machine_setup" |
##### example
```yaml
clone:
url: "git@github.com:timopruesse/machine_setup.git"
target: "~/machine_setup"
```
#### symlink
This command symlinks all the files from the source directory to the target directory.
| argument | value | required | example |
| -------- | ----------------------------------- | :------: | --------------------------------- |
| src | source directory/file | Y | "./src/files" or "./src/test.txt" |
| target | target directory/file | Y | "/tmp/target" or "/tmp/new.txt" |
| ignore | list of files/directories to ignore | - | ["dist", "package-lock.json"] |
| force | true/false | - | |
| sudo | run file operations with sudo | - | true |
> If `force` is set to `true`, existing files will be **removed** and replaced by the symlinks.
##### example
```yaml
symlink:
src: "./src/files"
target: "/tmp/target"
ignore: ["dist", "package-lock.json"]
force: true
# Symlink to a protected path
symlink:
src: "./etc/my.conf"
target: "/etc/my.conf"
sudo: true
force: true
```
#### run
This command executes a shell command.
> Hint: Avoid the usage of interactive commands when possible.
| argument | description | required | default | values |
| -------- | --------------------- | :------: | ------- | ---------------------------- |
| env | environment variables | - | | |
| shell | shell that is used | - | "bash" | "bash", "zsh", "powershell" |
By default, shell commands will only run during `install`.
You can provide mode-specific commands using `install`, `update`, and `uninstall` instead of `commands`:
| argument | description | required | example |
| --------- | ------------------------ | :------: | ------------------------------- |
| commands | commands for all modes | - | "sudo apt-get -y install git" |
| install | commands for installing | - | "sudo apt-get -y install git" |
| update | commands for updating | - | "sudo apt-get -y upgrade git" |
| uninstall | commands for uninstalling| - | "sudo apt-get -y uninstall git" |
> Use either `commands` (runs on install only) or `install`/`update`/`uninstall` for mode-specific behavior. They are all top-level keys under `run`.
##### example
```yaml
inline_command:
run:
commands: "sudo apt-get -y install git"
multiline_command:
run:
commands:
- "sudo apt-get update"
- "sudo apt-get -y install git"
updatable_command:
run:
env:
SOME_TOKEN: "abc123"
install: "sudo apt-get -y install git"
update: "sudo apt-get -y upgrade git"
uninstall: "sudo apt-get -y uninstall git"
updatable_multiline_command:
run:
env:
SOME_TOKEN: "abc123"
install:
- "sudo apt update"
- "sudo apt-get -y install git"
update:
- "sudo apt-get -y upgrade git"
uninstall:
- "sudo apt-get -y uninstall git"
```
#### machine_setup
With this command it's possible to include other `machine_setup` configuration files.
| argument | description | required | example |
| -------- | --------------------------------------- | :------: | ------------------------ |
| config | path to the other config file | Y | "./my_other_config.yaml" |
| task | define a single task that should be run | - | "my_other_task" |
##### example
```yaml
machine_setup:
config: "./my_other_config.yaml"
task: "my_other_task" # optional
```