  Planets acquire atmospheres from their parent circumstellar disks. We derive
a general analytic expression for how the atmospheric mass grows with time $t$,
as a function of the underlying core mass $M_{\rm core}$ and nebular
conditions, including the gas metallicity $Z$. Planets accrete as much gas as
can cool: an atmosphere's doubling time is given by its Kelvin-Helmholtz time.
Dusty atmospheres behave differently from atmospheres made dust-free by grain
growth and sedimentation. The gas-to-core mass ratio (GCR) of a dusty
atmosphere scales as GCR $\propto t^{0.4} M_{\rm core}^{1.7} Z^{-0.4} \mu_{\rm
rcb}^{3.4}$, where $\mu_{\rm rcb} \propto 1/(1-Z)$ (for $Z$ not too close to 1)
is the mean molecular weight at the innermost radiative-convective boundary.
This scaling applies across all orbital distances and nebular conditions for
dusty atmospheres; their radiative-convective boundaries, which regulate
cooling, are not set by the external environment, but rather by the internal
microphysics of dust sublimation, H$_2$ dissociation, and the formation of
H$^-$. By contrast, dust-free atmospheres have their radiative boundaries at
temperatures $T_{\rm rcb}$ close to nebular temperatures $T_{\rm out}$, and
grow faster at larger orbital distances where cooler temperatures, and by
extension lower opacities, prevail. At 0.1 AU in a gas-poor nebula, GCR
$\propto t^{0.4} T_{\rm rcb}^{-1.9} M_{\rm core}^{1.6} Z^{-0.4} \mu_{\rm
rcb}^{3.3}$, while beyond 1 AU in a gas-rich nebula, GCR $\propto t^{0.4}
T_{\rm rcb}^{-1.5} M_{\rm core}^1 Z^{-0.4}\mu_{\rm rcb}^{2.2}$. We confirm our
analytic scalings against detailed numerical models for objects ranging in mass
from Mars (0.1 $M_\oplus$) to the most extreme super-Earths (10-20 $M_\oplus$),
and explain why heating from planetesimal accretion cannot prevent the latter
from undergoing runaway gas accretion.
