# How to update all packages at once on Arch

Pretty straightforward terminal commands, but they need to be done in order to enable a seamless upgrade.

# Install yay

Yay is a direct replacement for Pacman, all the commands do the same thing, except with the added benefit of searching the AUR for package names as well as the normal repositories.
### Install Commands:
    sudo pacman -Syy
    sudo pacman -S --needed base-devel
    sudo pacman -S git
    git clone https://aur.archlinux.org/yay.git
    cd yay
    makepkg -si

* ***note:** makepkg flags: `-s` = install missing dependancies, `-i` = install package after building.*

### Results:
use `yay` instead of `pacman` for all package management tasks.

In the future, yay will update itself during full system upgrades (`yay -Syyu` or just `yay`). See the next page in this guide for fixes to some issues that may interrupt these upgrades.

# Terminal Commands

### To Update:
Run these commands in order:

    yay -Syy
    yay -S archlinux-keyring
    yay -Syu
* ***Note**: if you are prompted to add GPG signatures after downloading updated packages in command 3, cancel the upgrade and re-start from the first command! All the downloaded packages remain in temp storage, so you won't have to re-download anything!*

### Why 3 commands and not just `yay`?

Running `yay` is a shortcut for `yay -Syyu`, a twofer all-in-one "system upgrade" command that updates repositories (`-Syy`), then upgrades all normal/AUR packages (`-Syu`). However...

Often when upgrading packages, a new contributer is added, with a new GPG signature. Updating the core repositories, then the `archlinux-keyring` package, ensures that all the correct GPG signatures are installed before upgrading. Skipping these steps may cause some upgrades to fail, as the updated packages may have new signers that are not yet in the system's keyring, and thus the integrity checks will fail.