2018-06-28 12:04:56 +03:00
# Topgrade
[](https://travis-ci.org/r-darwish/topgrade)
[](https://ci.appveyor.com/project/r-darwish/topgrade)
2018-08-29 14:40:59 +03:00

2018-07-05 13:01:43 +03:00
[](https://crates.io/crates/topgrade)
2018-08-22 16:59:28 +03:00
[](https://aur.archlinux.org/packages/topgrade/)
2018-08-29 14:40:59 +03:00

2018-05-31 16:27:23 +03:00

Keeping your system up to date mostly involves invoking more than a single package manager. This
2018-06-10 11:23:44 +03:00
usually results in big shell one-liners saved in your shell history. Topgrade tries to solve this
2018-06-11 16:51:14 +03:00
problem by detecting which tools you use and run their appropriate package managers.
2018-05-31 16:27:23 +03:00
2018-12-17 11:01:21 +02:00
## Supported Platforms
Topgrade should probably work on whichever platform it can be build. The real question is whether
Topgrade knows that platform and can utilize its unique features, such as the operating system's
2019-05-16 10:19:11 +02:00
package manager. Topgrade is tested on and knows the following platforms:
2018-12-17 11:01:21 +02:00
* Linux
2019-05-16 16:42:52 +03:00
* Arch based
* Red Hat based
* Debian based
2018-12-17 11:01:21 +02:00
* Gentoo
* openSUSE
* Void
* FreeBSD
* macOS
* Windows
2018-05-31 16:27:23 +03:00
## Installation
2018-06-10 14:42:10 +03:00
Arch Linux users can use the [AUR ](https://aur.archlinux.org/packages/topgrade/ ) package.
2018-08-29 11:43:44 +03:00
macOS users can install topgrade via Homebrew.
2018-09-05 11:23:04 +03:00
Other systems users can either use `cargo install` or use the compiled binaries from the release
2018-11-07 14:31:44 +02:00
page. The compiled binaries contain a self-upgrading feature.
2018-09-05 11:23:04 +03:00
Topgrade isn't guaranteed to work on Rust versions older than the latest stable release. If you
intend to install Topgrade using Cargo then you should either install Rust using rustup or use a
distribution which ships the latest version of Rust, such as Arch Linux.
2018-05-31 16:27:23 +03:00
## Usage
2018-06-11 16:51:14 +03:00
Just run `topgrade` . It will run the following steps:
2019-06-03 09:41:25 +03:00
* Try to self-upgrade if compiled with this feature. Topgrade will respawn itself if it was upgraded.
2018-12-17 10:56:49 +02:00
* **Linux**: Run the system package manager:
2019-05-16 16:42:52 +03:00
* **Arch based**: Run [yay ](https://github.com/Jguer/yay ) or fall back to pacman
* **Redhat based**: Run `yum upgrade` (or `dnf` if present)
* **Debian based**: Run `apt update && apt dist-upgrade`
2018-12-17 10:56:49 +02:00
* **Gentoo**: Run `layman -s ALL && emerge --sync -q && eix-update && emerge -uDNa world`
* **openSUSE**: Run `zypper refresh && zypper dist-upgrade`
* **Void**: Run `xbps-install -Su`
* **Linux**: Run [etc-update ](https://dev.gentoo.org/~zmedico/portage/doc/man/etc-update.1.html ):
* **FreeBSD**: Upgrade and audit packages
* **Unix**: Run `brew update && brew upgrade` . This should handle both Homebrew and Linuxbrew
* **Unix**: Run `nix upgrade-nix && nix --upgrade` .
2019-02-20 22:22:42 +11:00
* **Unix**: Run [Pearl ](https://github.com/pearl-core/pearl ) `pearl update` .
2019-06-04 09:35:29 +03:00
* **Windows**: Run Topgrade inside WSL.
2018-12-17 10:56:49 +02:00
* **Windows**: Upgrade Powershell modules
* **Windows**: Upgrade all [Chocolatey ](https://chocolatey.org/ ) packages
* **Windows**: Upgrade all [Scoop ](https://scoop.sh ) packages
2018-05-31 16:27:23 +03:00
* Check if the following paths are tracked by Git. If so, pull them:
* ~/.emacs.d (Should work whether you use [Spacemacs ](http://spacemacs.org/ ) or a custom configuration)
* ~/.zshrc
* [~/.oh-my-zsh ](https://github.com/robbyrussell/oh-my-zsh )
* ~/.tmux
2018-07-05 20:46:05 +03:00
* ~/.config/fish
* ~/.config/nvim
* ~/.vim
2018-08-27 15:22:44 +03:00
* ~/.config/openbox
2019-03-14 21:38:55 +02:00
* ~/.config/bspwm
* ~/.config/i3
2018-08-23 22:08:04 +03:00
* Powershell Profile
2018-06-11 13:57:38 +03:00
* Custom defined paths
2018-12-17 10:56:49 +02:00
* **Unix**: Run [zplug ](https://github.com/zplug/zplug ) update
* **Unix**: Run [fisher ](https://github.com/jorgebucaran/fisher )
* **Unix**: Upgrade tmux plugins with [TPM ](https://github.com/tmux-plugins/tpm ). * Note * : Do not use
2018-11-20 09:11:44 +02:00
the `-b` flag in your configuration as suggested by the TPM readme.
2018-06-25 22:35:58 +03:00
* Update Rustup by running `rustup update` . This will also attempt to run `rustup self update` when Rustup is installed inside the home directory.
2018-06-11 16:51:14 +03:00
* Run Cargo [install-update ](https://github.com/nabijaczleweli/cargo-update )
2018-08-29 14:38:03 +03:00
* Upgrade Emacs packages (You'll get a better output if you have [Paradox ](https://github.com/Malabarba/paradox ) installed)
2018-09-03 13:45:01 +02:00
* Upgrade [OCaml packages ](https://opam.ocaml.org/ )
2018-11-10 20:22:26 +02:00
* Upgrade [vcpkg ](https://github.com/Microsoft/vcpkg ) globally installed packages
2019-05-15 11:33:22 +02:00
* Upgrade [myrepos ](https://myrepos.branchable.com/ ) managed sourcecode repositories
2018-10-31 13:01:57 +02:00
* Upgrade Python packages installed using [pipx ](https://github.com/cs01/pipx )
2018-10-18 16:05:27 +03:00
* Upgrade [R globally installed packages ](https://github.com/ankane/jetpack )
2018-07-04 09:51:19 +02:00
* Upgrade Vim/Neovim packages. Works with the following plugin frameworks:
2018-06-07 08:51:16 +03:00
* [NeoBundle ](https://github.com/Shougo/neobundle.vim )
* [Vundle ](https://github.com/VundleVim/Vundle.vim )
* [Plug ](https://github.com/junegunn/vim-plug )
2019-05-14 18:35:02 +02:00
* [Dein ](https://github.com/Shougo/dein.vim )
2018-09-06 15:42:39 +03:00
* Node
* Run `yarn global update` if yarn is installed.
* Run `npm update -g` if NPM is installed and `npm root -g` is a path inside your home directory.
2018-12-17 10:53:05 +02:00
* Run `composer global update` if Composer's home directory is inside the home directory of the
user. Run `valet install` after.
2018-06-06 11:29:55 +03:00
* Upgrade Atom packages
2018-09-06 17:04:31 +03:00
* Run `gem upgrade --user-install` if `~/.gem` exists
2018-12-17 10:56:49 +02:00
* **Linux**: Update Flatpak packages
* **Linux**: Update snap packages
* **Linux**: Run [fwupdmgr ](https://github.com/hughsie/fwupd ) to show firmware upgrade. (View
2018-06-11 13:57:38 +03:00
only. No upgrades will actually be performed)
2019-05-15 11:34:20 +02:00
* **Linux**: Run `rpi-update` to update Raspberry Pi Firmware
2019-05-15 12:08:15 +02:00
* **Linux**: Run [pihole ](https://pi-hole.net/ ) updater
2018-06-11 13:57:38 +03:00
* Run custom defined commands
2018-06-11 08:29:40 +03:00
* Final stage
2018-12-17 10:56:49 +02:00
* **Linux**: Run [needrestart ](https://github.com/liske/needrestart )
* **Windows**: Run Windows Update (You'll have to install [PSWindowsUpdate ](https://marckean.com/2016/06/01/use-powershell-to-install-windows-updates/ ))
* **macOS**: Upgrade App Store applications
* **FreeBSD**: Run `freebsd-upgrade`
2018-06-11 13:57:38 +03:00
2018-06-20 21:05:49 +03:00
## Flags
* `-t/--tmux` - Topgrade will launch itself in a new tmux session. This flag has no effect if
Topgrade already runs inside tmux. This is useful when using topgrade on remote systems.
2018-11-17 19:09:46 +01:00
* `-c/--cleanup` - Topgrade will instruct package managers to remove old or unused files
2018-08-27 13:17:27 +03:00
* `-n/--dry-run` - Print what should be run.
2019-01-16 11:24:37 +02:00
* `--disable [STEPS]` - Disable one or more steps:
* `system` - Skip the system upgrade phase.
* `git-repos` - Don't pull custom git repositories.
* `emacs` - Don't upgrade Emacs packages or configuration files.
* `vim` - Don't upgrade Vim/NeoVim packages or configuration files.
* `gem` - Don't upgrade ruby gems.
2018-12-05 13:38:18 +02:00
* `--no-retry` - Don't ask to retry failed steps.
2018-06-20 21:05:49 +03:00
2018-06-11 13:57:38 +03:00
## Customization
2019-01-21 20:17:44 +02:00
Here's an example for a configuration file:
2018-06-11 13:57:38 +03:00
``` toml
git_repos = [
"~/dev/topgrade",
]
2019-01-22 22:37:32 +02:00
# Same options as the command line flag
disable = ["system", "emacs"]
2018-06-20 20:26:08 +03:00
[pre_commands]
"Emacs Snapshot" = "rm -rf ~/.emacs.d/elpa.bak && cp -rl ~/.emacs.d/elpa ~/.emacs.d/elpa.bak"
2018-06-11 13:57:38 +03:00
[commands]
"Python Environment" = "~/dev/.env/bin/pip install -i https://pypi.python.org/simple -U --upgrade-strategy eager jupyter"
```
2018-06-20 20:26:08 +03:00
* `git_repos` - A list of custom Git repositories to pull
* `pre_commands` - Commands to execute before starting any action. If any command fails, Topgrade
will not proceed
* `commands` - Custom upgrade steps. If any command fails it will be reported in the summary as all
upgrade steps are reported, but it will not cause Topgrade to stop.
2019-01-21 20:17:44 +02:00
### Configuration path
The configuration should be placed in the following paths depending by the operating system:
* **macOS** - `~/Library/Preferences/topgrade.toml`
* **Windows** - `%APPDATA%/topgrade.toml`
* **Other Unix systems** - `~/.config/topgrade.toml`