A modern dotfile manager for tracking and syncing configuration files
Overview • Installation • Usage • Commands • Configuration • How It Works • License
dotx helps you manage, version control, and synchronize your configuration files (dotfiles) across multiple systems. It provides a simple and intuitive CLI to:
- Track configuration files in a Git repository
- Deploy your dotfiles to new systems
- Synchronize changes across multiple machines
- Maintain a clean and organized dotfiles setup
go install github.com/mxlang/dotx/cmd/dotx@latest# Clone the repository
git clone https://github.com/mxlang/dotx.git
# Navigate to the project directory
cd dotx
# Build and install
go install ./cmd/dotxeval "$(dotx init <shell>)"- Initialize your dotfiles repository:
# Clone an existing dotfiles repository
dotx sync init https://github.com/username/dotfiles.git- Add configuration files:
# Add your shell configuration
dotx add ~/.bashrc
# Add a directory of configuration files
dotx add ~/.config/nvim- Deploy your dotfiles on a new system:
# After initializing your repository
dotx deploy- Synchronize changes:
# Pull latest changes from remote
dotx sync pull
# Push your changes to remote
dotx sync push -m "Update nvim configuration"All commands support the following flags:
--verbose(-v): Enable more detailed output, which can be helpful for debugging.--version: Display the current version information for dotx.
Add one or more files or directories to your dotfiles. This command tracks configuration files or directories in your dotfiles by creating symlinks to their original locations.
dotx add <path>... [-d, --dir]Options:
-d, --dir: Optional directory to add the dotfile to
Example:
dotx add ~/.bashrc
dotx add ~/.config/nvim
dotx add ~/.bashrc ~/.zshrc
dotx add -d starship ~/.config/starship.tomlDeploy your dotfiles to the current system. This command creates symbolic links from your dotfiles to their appropriate locations in your home directory.
dotx deploy [-f, --force]Options:
-f, --force: Do not prompt for confirmation when overwriting existing files
Example:
dotx deploy
dotx deploy --forceGo to your local dotfiles directory. You need to add eval "$(dotx init <shell>)" to your shell config to work properly. It has to be one of the following options: bash, zsh, fish.
Example:
dotx cdInspect your system and repository for undeployed dotfiles and help you link them. This command scans your dotx repository for dotfiles that are not currently deployed (i.e., not symlinked in their destination paths) and presents a TUI to choose which ones to deploy.
dotx doctor [-f, --force]Options:
-f, --force: Never prompt for overwriting existing files when deploying selected dotfiles
Example:
dotx doctor
dotx doctor --force # Deploy without any overwrite promptsManage Git operations for your dotfiles repository. This command provides subcommands for initializing, pulling, and pushing changes to synchronize your dotfiles across systems.
Initialize by cloning a remote dotfiles repository. This command sets up your dotfiles environment by cloning an existing Git repository containing your configuration files.
dotx sync init <repository-url> [-d, --deploy] [-f, --force]Options:
-d, --deploy: Automatically deploy dotfiles after initialization-f, --force: Do not prompt for confirmation when overwriting existing files
Example:
dotx sync init https://github.com/username/dotfiles.git
dotx sync init https://github.com/username/dotfiles.git --deploy --forceUpdate local dotfiles by pulling changes from the remote repository. This command fetches and merges the latest changes from your remote dotfiles repository to keep your local copy up-to-date.
dotx sync pull [-d, --deploy] [-f, --force]Options:
-d, --deploy: Automatically deploy dotfiles after pulling-f, --force: Do not prompt for confirmation when overwriting existing files
Example:
dotx sync pull
dotx sync pull --deploy --forceSave and upload local dotfile changes to the remote repository. This command commits local changes to your dotfiles and pushes them to the remote repository for backup and sharing.
dotx sync push [-m, --message <commit-message>]Options:
-m, --message: Specify a commit message (if not provided, you'll be prompted to enter one)
Example:
dotx sync push
dotx sync push -m "Update bash aliases"dotx uses a configuration file that follows the XDG Base Directory Specification. Located at $XDG_DATA_HOME/dotx/dotfiles/dotx.yaml (typically ~/.local/share/dotx/dotfiles/dotx.yaml on Linux and ~/Library/Application Support/dotx/dotfiles/dotx.yaml on macOS):
dotfiles:
- source: "/.bashrc"
destination: "$HOME/.bashrc"
- source: "/.config/nvim"
destination: "$HOME/.config/nvim"
scripts:
- path: "setup.sh"
on: init # one of: init, pull, deploy — note: 'run' is not allowed for init scripts
- path: "scripts/bootstrap.sh"
on: pull
run: changed # optional: always (default) | once | changedThis file is automatically updated when you add new dotfiles using the add command. You can define scripts as list entries with a path and an on event (one of: init, pull, deploy). Optionally set run to control execution frequency: always (default), once, or changed (runs when the file content hash changes). Note: the run property is not allowed for scripts with on: init. Scripts fire on the corresponding commands: init for dotx sync init, pull for dotx sync pull, and deploy for dotx deploy.
-
When you add a file with
dotx add:- The original file is moved to the dotfiles repository
- A symbolic link is created at the original location, pointing to the file in the repository
- The mapping between the repository file and the original location is stored in the configuration
-
When you deploy with
dotx deploy:- Symbolic links are created based on the mappings in the configuration
- If a file already exists at the target location, you'll be prompted to overwrite it
~/.local/share/dotx/dotfiles/ # Default repository location
├── .bashrc # Your actual configuration files
├── .vimrc
├── .config/
│ └── nvim/ # Directories are preserved
│ ├── init.vim
│ └── ...
│ setup.sh # Example script referenced by scripts entries
├── scripts/
│ └── bootstrap.sh
└── dotx.yaml # Repository configuration file
dotx sync pullfetches changes from your remote repositorydotx sync pushcommits and pushes your local changes to the remote- This allows you to keep your dotfiles in sync across multiple machines
dotx allows you to automate custom setup steps by defining scripts (also known as hooks) in your repository configuration file (dotx.yaml). These scripts are especially useful for tasks such as installing dependencies, setting up environments, or running any initialization logic.
Define scripts under scripts as a list of entries with a path, an on event, and an optional run condition (except for on: init, where run is not allowed):
scripts:
- path: "scripts/bootstrap.sh"
on: init
- path: "scripts/post-pull.sh"
on: pull
- path: "scripts/post-deploy.sh"
on: deployoncontrols when the script runs. Allowed values:init,pull,deploy.runcontrols how often the script runs (not supported foron: initscripts):always(default): run every time the event occursonce: run only once everchanged: run only if the file's content hash has changed since the last run
Execution:
dotx sync inittriggers scripts withon: init(after cloning and setup)dotx sync pulltriggers scripts withon: pull(after pulling updates)dotx deploytriggers scripts withon: deploy(after deployment)
- Installing required packages
- Setting up programming language environments
- Configuring system preferences
- Running custom shell commands
This project is licensed under the Apache License 2.0.