Skip to content

Commit

Permalink
Document one-line chezmoi and dotfiles install
Browse files Browse the repository at this point in the history
  • Loading branch information
twpayne committed Apr 12, 2021
1 parent 8322943 commit 93c53da
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
3 changes: 3 additions & 0 deletions chezmoi.io/content/_index.md
Expand Up @@ -7,6 +7,9 @@ type: docs

Manage your dotfiles across multiple diverse machines, securely.

chezmoi makes installing your dotfiles on any new machine as easy as `sh -c
"$(curl -fsLS git.io/chezmoi)" -- init --apply <github-username>`.

## How do I start with chezmoi now?

[Install chezmoi](/docs/install/) then read the [quick start
Expand Down
24 changes: 23 additions & 1 deletion docs/HOWTO.md
Expand Up @@ -6,6 +6,7 @@
* [Pull the latest changes from your repo and apply them](#pull-the-latest-changes-from-your-repo-and-apply-them)
* [Pull the latest changes from your repo and see what would change, without actually applying the changes](#pull-the-latest-changes-from-your-repo-and-see-what-would-change-without-actually-applying-the-changes)
* [Automatically commit and push changes to your repo](#automatically-commit-and-push-changes-to-your-repo)
* [Install chezmoi and your dotfiles on a new machine with a single command](#install-chezmoi-and-your-dotfiles-on-a-new-machine-with-a-single-command)
* [Manage different types of file](#manage-different-types-of-file)
* [Have chezmoi create a directory, but ignore its contents](#have-chezmoi-create-a-directory-but-ignore-its-contents)
* [Ensure that a target is removed](#ensure-that-a-target-is-removed)
Expand Down Expand Up @@ -116,6 +117,27 @@ Be careful when using `autoPush`. If your dotfiles repo is public and you
accidentally add a secret in plain text, that secret will be pushed to your
public repo.

### Install chezmoi and your dotfiles on a new machine with a single command

chezmoi's install script can run `chezmoi init` for you by passing extra
arguments to the newly installed chezmoi binary. If your dotfiles repo is
`github.com/<github-username>/dotfiles` then installing chezmoi, running
`chezmoi init`, and running `chezmoi apply` can be done in a single line of
shell:

sh -c "$(curl -fsLS git.io/chezmoi)" -- init --apply <github-username>

If your dotfiles repo has a different name to `dotfiles`, or if you host your
dotfiles on a different service, then see the [reference manual for `chezmoi
init`](https://github.com/twpayne/chezmoi/blob/master/docs/REFERENCE.md#init-repo).

For setting up transitory environments (e.g. short-lived Linux containers) you
can install chezmoi, install your dotfiles, and then remove all traces of
chezmoi, including the source directory and chezmoi's configuration directory,
with a single command:

sh -c "$(curl -fsLS git.io/chezmoi)" -- init --one-shot <github-username>

## Manage different types of file

### Have chezmoi create a directory, but ignore its contents
Expand Down Expand Up @@ -939,7 +961,7 @@ if [ ! "$(command -v chezmoi)" ]; then
bin_dir="$HOME/.local/bin"
chezmoi="$bin_dir/chezmoi"
if [ "$(command -v curl)" ]; then
sh -c "$(curl -fsSL https://git.io/chezmoi)" -- -b "$bin_dir"
sh -c "$(curl -fsLS https://git.io/chezmoi)" -- -b "$bin_dir"
elif [ "$(command -v wget)" ]; then
sh -c "$(wget -qO- https://git.io/chezmoi)" -- -b "$bin_dir"
else
Expand Down
8 changes: 7 additions & 1 deletion docs/INSTALL.md
Expand Up @@ -13,7 +13,13 @@
Install the correct binary for your operating system and architecture in `./bin`
with a single command.

curl -sfL https://git.io/chezmoi | sh
sh -c "$(curl -fsLS git.io/chezmoi)"

If you already have a dotfiles repo using chezmoi on GitHub at
`https://github.com/<github-username>/dotfiles` then you can install chezmoi and
your dotfiles with the single command:

sh -c "$(curl -fsLS git.io/chezmoi)" -- init --apply <github-username>

Or on systems with Powershell, you can use this command:

Expand Down

3 comments on commit 93c53da

@felipecrs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth noting somewhere that wget -qO- is an equivalent to curl -fsSL. Wget comes installed with Ubuntu, but cURL no.

@twpayne
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great idea! Done in 179cbfc. Thanks @felipecrs :)

@felipecrs
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

Please sign in to comment.