When is the ring homomorphism $\mathbb{Z} \to R$ an epimorphism?

Let me summarize what I've learned from the comments. A ring $R$ for which the unique homomorphism from $\mathbb{Z}$ to $R$ is an epimorphism is called a solid ring. Such rings are necessarily commutative, by Prop. 1.3 (b) of this paper:

  • H. H. Storrer, Epimorphic extensions of non-commutative rings, Commentarii Mathematici Helvetici 48 (1973), 72–86.

By well-known results in commutative ring theory, a solid ring is thus the same as any of these:

  • a commutative ring $R$ for which the multiplication map $m \colon R \otimes R \to R$ is an isomorphism;

  • a commutative ring $R$ such that the forgetful functor $R\, \mathsf{Mod} \to \mathsf{AbGp}$ is full.

  • a commutative ring whose core $ cR = \{r \in R: r \otimes 1 = 1 \otimes r \in R \otimes_\mathbb{Z} R \} $ is all of $R$.

Commutative solid rings, and thus all solid rings, were classified here:

  • A. K. Bousfield and D. M. Kan, The core of a ring, Journal of Pure and Applied Algebra 2 (1972), 73–81.

The following rings are solid:

  1. $\mathbb{Z}/n$ for any $n$.
  2. any subring $R \subseteq \mathbb{Q}$. Such a subring is always of the form $\mathbb{Z}[P^{-1}]$, meaning the ring of fractions whose denominators (in lowest terms) are divisible only by the primes in some set $P$ of primes.
  3. any ring of the form $\mathbb{Z}[P^{-1}] \times \mathbb{Z}/n$ where each prime factor of $n$ is in $P$.

Bousfeld and Kan show that in the category of commutative rings, every colimit of solid rings is solid. They also show that every solid ring is a colimit, in the category of commutative rings, of solid rings of the above three types.

Bousfeld and Kan also give a more explicit description of all the solid rings. They show that every solid ring is either of types 1-3 or of a fourth type:

  1. $c(\mathbb{Z}[P^{-1}] \times \prod_{p \in Q} \mathbb{Z}/p^{e(p)}) $, where $P$ and $Q$ are infinite sets of primes with $Q \subseteq P$ and each $e(p)$ is a positive integer. (Here $c$ stands for the core, as defined above.)