Arch downloads its packages from "mirrors" — servers around the world that hold copies of the official repos. The default mirror list in /etc/pacman.d/mirrorlist after a fresh install is alphabetical and often slow. reflector is a small tool that picks the fastest, most up-to-date ones for you, automatically.
A primer on the mirror list
Open the file:
cat /etc/pacman.d/mirrorlist
You'll see hundreds of lines like:
## Australia
Server = https://mirror.aarnet.edu.au/pub/archlinux/$repo/os/$arch
## Austria
Server = https://mirror.easyname.at/archlinux/$repo/os/$arch
pacman tries the first uncommented mirror, then the next if it fails. The order is yours to set. Putting a slow mirror at the top costs you minutes every time you install something.
Install reflector
sudo pacman -S reflector
The one-shot ranking
sudo reflector --country Norway,Sweden,Denmark --age 12 --protocol https
--sort rate --save /etc/pacman.d/mirrorlist
Walking through the flags:
--country— only consider mirrors in these countries. Pick a few near you.--age 12— only mirrors synced within the last 12 hours. Older mirrors mean you'd be installing stale packages.--protocol https— drop the bare-http ones. (Arch package signatures already protect integrity; https mainly protects your privacy.)--sort rate— measure download speed from each candidate and sort fastest first. Takes a minute.--save /etc/pacman.d/mirrorlist— write the result into the real file.
Always back up the existing list first:
sudo cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
After reflector finishes, refresh pacman's package list:
sudo pacman -Syyu
(-yy forces a fresh download of the database from the new mirrors.)
Sort options that aren't "rate"
--sort age # most recently synced first (don't download, just look at metadata)
--sort country # alphabetical by country (boring but fast to compute)
--sort score # the Arch project's own scoring (combination)
--sort delay # closest to current time, similar to age
--sort rate is slow because reflector actually measures throughput against each candidate. --sort age takes about a second and is good enough most of the time.
Schedule it to run on its own
Mirrors come and go. Pin reflector to a timer so your list stays fresh:
Reflector ships with a systemd service and timer ready to go:
sudo systemctl edit reflector.service
Replace the contents with the flags you want:
[Service]
ExecStart=
ExecStart=/usr/bin/reflector --country Norway,Sweden,Denmark --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
(The empty ExecStart= line clears the default before adding yours.)
Enable the weekly timer:
sudo systemctl enable --now reflector.timer
systemctl list-timers reflector.timer
Every week it refreshes your mirror list in the background.
Run it after every system update (alternative)
Drop a pacman hook so reflector reruns whenever the pacman-mirrorlist package changes:
sudo nano /etc/pacman.d/hooks/mirrorupgrade.hook
[Trigger]
Operation = Upgrade
Type = Package
Target = pacman-mirrorlist
[Action]
Description = Updating pacman-mirrorlist with reflector and removing pacnew...
When = PostTransaction
Depends = reflector
Exec = /bin/sh -c "reflector --country Norway,Sweden,Denmark --age 12 --protocol https --sort rate --save /etc/pacman.d/mirrorlist; rm -f /etc/pacman.d/mirrorlist.pacnew"
Pick either the weekly timer or this hook, not both.
If a single mirror is broken right now
Sometimes reflector returns mirrors that look fast but are actually stale or down. Symptom: pacman -Syu fails with "404 Not Found" on every package, even though the list looks fine.
Quick check — does any mirror in the list have today's sync date?
head -5 /etc/pacman.d/mirrorlist
curl -sI https://<the-top-mirror>/lastupdate
If the top mirror is broken, just delete its line and try again. Or re-run reflector with a tighter --age like --age 6.
The bottom line
You set this up once, schedule it, and forget about it. Pacman gets quietly faster forever. The whole tweak is two commands plus a one-line timer change.