I have this function in my
~/.zshrc (or equivalent for your shell) that will work for both reflector and rankmirrors (part of pacman-contrib). You’ll find it in your
mir() # update pacman mirror list
if hash reflector >/dev/null 2>&1; then
su -c 'reflector --score 100 -l 50 -f 10 --sort rate --save /etc/pacman.d/mirrorlist --verbose'
elif hash rankmirrors >/dev/null 2>&1; then
su -c "curl -L '$s' | sed -e 's/^#Server/Server/' -e '/^#/d' | rankmirrors -v -t -n 10 - > /etc/pacman.d/mirrorlist"
printf "this requires reflector or rankmirrors installed\n"; return 1
Mind the hardcoded bit for rankmirrors in the actual mirror source
?country=US&country=CA you’ll want to change these to country codes near you, for example NZ and AU would use
?country=NZ&country=AU. This only matters if you don’t have reflector.
So you can just open a shell and run
mir you’ll be prompted for password then a list of all the mirrors it’s sorting followed by the ranked list and the fastest 10 are dumped to
You can also just change the name of the function if you prefer something more familiar.