  Ultralight dark matter (such as kinetically mixed dark-photon dark matter or
axionlike dark matter) can source an oscillating magnetic-field signal at the
Earth's surface, which can be measured by a synchronized array of ground-based
magnetometers. The global signal of ultralight dark matter can be robustly
predicted for low masses, when the wavelength of the dark matter is larger than
the radius of the Earth, $\lambda_\mathrm{DM}\gg R$. However, at higher masses,
environmental effects, such as the Schumann resonances, can become relevant,
making the global magnetic-field signal $\mathbf B$ difficult to reliably
model. In this work, we show that $\nabla\times\mathbf B$ is robust to global
environmental details, and instead only depends on the local dark matter
amplitude. We therefore propose to measure the local curl of the magnetic field
at the Earth's surface, as a means for detecting ultralight dark matter with
$\lambda_\mathrm{DM}\lesssim R$. As this measurement requires vertical
gradients, it can be done near a hill/mountain. Our measurement scheme not only
allows for a robust prediction, but also acts as a background rejection scheme
for external noise sources. We show that our technique can be the most
sensitive terrestrial probe of dark-photon dark matter for frequencies
$10\,\mathrm{Hz}\leq f_{A'}\leq1\,\mathrm{kHz}$ (corresponding to masses
$4\times10^{-14}\,\mathrm{eV}\leq m_{A'}\leq4\times10^{-12}\,\mathrm{eV}$). It
can also achieve sensitivities to axionlike dark matter comparabe to the CAST
helioscope, in the same frequency range.
