Aims. The goal of this work is to study the formation of rocky planets by dry pebble accretion from self-consistent dust-growth models. In particular, we aim to compute the maximum core mass of a rocky planet that can sustain a thin H-He atmosphere to account for the second peak of the Kepler size distribution.

Methods. We simulate planetary growth by pebble accretion inside the ice line. The pebble flux is computed self-consistently from dust growth by solving the advection–diffusion equation for a representative dust size. Dust coagulation, drift, fragmentation, and sublimation at the water ice line are included. The disc evolution is computed solving the vertical and radial structure for standard $\alpha$-discs with photoevaporation from the central star. The planets grow from a moon-mass embryo by silicate pebble accretion and gas accretion. We perform a parameter study to analyse the effect of a different initial disc mass, $\alpha$-viscosity, disc metallicity, and embryo location. We also test the effect of considering migration versus an in situ scenario. Finally, we compute atmospheric mass loss due to evaporation over 5 Gyr of evolution.

Results. We find that inside the ice line, the fragmentation barrier determines the size of pebbles, which leads to different planetary growth patterns for different disc viscosities. We also find that in this inner disc region, the pebble isolation mass typically decays to values below 5 $M_{\oplus}$ within the first million years of disc evolution, limiting the core masses to that value. After computing atmospheric mass loss, we find that planets with cores below ~4 $M_{\oplus}$ become completely stripped of their atmospheres, and a few 4–5 $M_{\oplus}$ cores retain a thin atmosphere that places them in the “gap” or second peak of the Kepler size distribution. In addition, a few rare objects that form in extremely low-viscosity discs accrete a core of 7 $M_{\oplus}$ and equal envelope mass, which is reduced to 3–5 $M_{\oplus}$ after evaporation. These objects end up with radii of ~6–7 $R_{\oplus}$.

Conclusions. Overall, we find that rocky planets form only in low-viscosity discs ($\alpha \leq 10^{−4}$). When $\alpha \geq 10^{−3}$, rocky objects do not grow beyond 1 Mars mass. For the successful low-viscosity cases, the most typical outcome of dry pebble accretion is terrestrial planets with masses spanning from that of Mars to ~4 $M_{\oplus}$.