Package Managers
Installing software by downloading an installer from a website, clicking Next five times and then hunting for updates later is slow and hard to repeat. A package manager does the same job from the terminal: it finds a program in a trusted catalogue (a repository), downloads it, installs it, puts it on your PATH and later updates or removes it, all with one command.
Every major OS now has at least one:
| OS | Package manager | Comes with the OS? | Typical use |
|---|---|---|---|
| Windows 10/11 | winget (Windows Package Manager) | yes (App Installer) | desktop apps and developer tools |
| Windows | Scoop | no | portable command-line tools, no admin needed |
| Windows | Chocolatey (choco) |
no | large catalogue, popular in companies |
| macOS | Homebrew (brew) |
no (one-line install) | almost all developer tools |
| Debian, Ubuntu, Mint | apt | yes | the whole system and its apps |
| Fedora, RHEL, Rocky | dnf | yes | the whole system and its apps |
| Arch, Manjaro | pacman | yes | the whole system and its apps |
| any Linux | Flatpak, Snap | some distros | sandboxed desktop apps |
The examples below are sessions recorded on real machines, not playgrounds: installing software needs network access and admin rights, which the sandboxes don't have. Version numbers in the sample output will differ on your machine.
The common verbs
All package managers follow the same small vocabulary. Once you know it for one, the others are easy:
| Task | winget | Scoop | Chocolatey | Homebrew | apt | dnf | pacman |
|---|---|---|---|---|---|---|---|
| Search | winget search jq |
scoop search jq |
choco search jq |
brew search jq |
apt search jq |
dnf search jq |
pacman -Ss jq |
| Install | winget install jqlang.jq |
scoop install jq |
choco install jq |
brew install jq |
sudo apt install jq |
sudo dnf install jq |
sudo pacman -S jq |
| List installed | winget list |
scoop list |
choco list |
brew list |
apt list --installed |
dnf list --installed |
pacman -Q |
| Refresh catalogue | automatic | scoop update |
automatic | brew update |
sudo apt update |
automatic | sudo pacman -Sy |
| Upgrade all | winget upgrade --all |
scoop update * |
choco upgrade all |
brew upgrade |
sudo apt upgrade |
sudo dnf upgrade |
sudo pacman -Syu |
| Remove | winget uninstall jqlang.jq |
scoop uninstall jq |
choco uninstall jq |
brew uninstall jq |
sudo apt remove jq |
sudo dnf remove jq |
sudo pacman -R jq |
| Show details | winget show jqlang.jq |
scoop info jq |
choco info jq |
brew info jq |
apt show jq |
dnf info jq |
pacman -Si jq |
Windows (winget, Scoop, Chocolatey)
winget is built into Windows 11 and current Windows 10 builds. It works the same from CMD and PowerShell, because it is a normal program (winget.exe), not a shell feature. Packages have an ID like Publisher.Name; using the exact ID with --id and -e (exact) avoids picking the wrong package:
C:\Users\ada>winget search jq
Name Id Version Source
------------------------------
jq jqlang.jq 1.8.1 winget
C:\Users\ada>winget install --id jqlang.jq -e
Found jq [jqlang.jq] Version 1.8.1
This application is licensed to you by its owner.
Downloading https://github.com/jqlang/jq/releases/download/jq-1.8.1/jq-windows-amd64.exe
██████████████████████████████ 1.07 MB / 1.07 MB
Successfully verified installer hash
Starting package install...
Path environment variable modified; restart your shell to use the new value.
Command line alias added: "jq"
Successfully installedNote the line about PATH: a terminal that is already open keeps its old copy of the environment, so open a new tab before using the tool (see The PATH Variable). Some winget installers show a UAC prompt because they install for all users.
Scoop installs command-line tools into your user profile (~\scoop), so it never needs administrator rights. You install it once from PowerShell:
PS C:\Users\ada> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
PS C:\Users\ada> Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
Initializing...
Downloading...
Creating shim...
Scoop was installed successfully!
PS C:\Users\ada> scoop install ripgrep
Installing 'ripgrep' (14.1.1) [64bit] from 'main' bucket
Linking ~\scoop\apps\ripgrep\current => ~\scoop\apps\ripgrep\14.1.1
Creating shim for 'rg'.
'ripgrep' (14.1.1) was installed successfully!Chocolatey has the biggest Windows catalogue and is common in company build scripts. It installs system-wide, so it runs from an administrator terminal (see Admin Rights & Permissions):
PS C:\Windows\system32> choco install git -y
Installing the following packages:
git
By installing, you accept licenses for the packages.
...
The install of git was successful.
Chocolatey installed 2/2 packages.Which one should you pick? Start with winget because it is already there. Add Scoop if you want many small CLI tools without admin prompts. Use Chocolatey when your team or CI already does.
macOS (Homebrew)
macOS has no command-line package manager of its own, but almost every developer installs Homebrew. The installer is a single command from brew.sh; on Apple silicon Macs it lives in /opt/homebrew. After that, brew never needs sudo:
ada@macbook ~ % brew install jq
==> Downloading https://ghcr.io/v2/homebrew/core/jq/manifests/1.8.1
==> Pouring jq--1.8.1.arm64_sequoia.bottle.tar.gz
🍺 /opt/homebrew/Cellar/jq/1.8.1: 19 files, 1.4MB
ada@macbook ~ % which jq
/opt/homebrew/bin/jq
ada@macbook ~ % brew install --cask visual-studio-code
==> Installing Cask visual-studio-code
🍺 visual-studio-code was successfully installed!Formulae are command-line tools; casks (--cask) are graphical .app programs. brew upgrade updates everything, brew outdated shows what would change and brew cleanup deletes old versions. Homebrew also runs on Linux, which is handy when you need a newer tool than your distro ships.
Linux (apt, dnf, pacman)
On Linux the package manager is part of the OS: it installs and updates the kernel, the libraries and your apps. Because it changes system files, installing needs sudo. On Debian and Ubuntu, refresh the catalogue first with apt update, then install:
ada@ubuntu:~$ sudo apt update
[sudo] password for ada:
Hit:1 http://archive.ubuntu.com/ubuntu noble InRelease
Get:2 http://security.ubuntu.com/ubuntu noble-security InRelease [126 kB]
Reading package lists... Done
ada@ubuntu:~$ sudo apt install jq
Reading package lists... Done
The following NEW packages will be installed:
jq libjq1 libonig5
Need to get 330 kB of archives.
Do you want to continue? [Y/n] y
...
Setting up jq (1.7.1-3build1) ...Notice that apt also installed two dependencies (libjq1, libonig5): resolving those automatically is a package manager's main job. Fedora's dnf install jq and Arch's pacman -S jq work the same way. A distro's packages are often a little older than the newest release, because they are tested together; Arch is a rolling release and is usually closest to the latest version.
Language package managers
Programming languages bring their own managers for libraries: pip/uv (Python), npm (JavaScript), cargo (Rust), gem (Ruby), go install. They work identically on all three OSes. Use the OS package manager for tools and the language one for the libraries of your project.
Good habits
- Prefer the package manager over downloading installers: updates become one command.
- Read what a command will do before answering
y, especially when it wants to remove packages. - Don't mix managers for the same tool (for example Python from both winget and the Microsoft Store), or you'll get two copies on
PATHand confusion about which one runs.where.exe python(Windows) orwhich -a python3(macOS/Linux) shows all of them. - Keep a list of what you install, so a new machine can be set up with a script.
winget export,brew bundle dumpandapt-mark showmanualproduce that list.
Learn more: Packages on Linux, PowerShell Modules, The PATH Variable.
Test yourself
Which package manager is built into Windows 11?
- Chocolatey
- Scoop
- winget
- Homebrew
On Ubuntu, what should you run before sudo apt install on a fresh machine?
sudo apt updatesudo apt upgrade --allapt listsudo apt clean
Why does Scoop not need administrator rights?
- It only installs fonts
- It installs into your user profile
- It disables UAC
- It runs inside WSL