I've seen this claim repeated in many places (always without source or proof), that $\mathrm{Spec}(\mathbb{Z})$ is a terminal object – however, the most I've been able to prove myself is that for any affine scheme $\mathrm{Spec}(R)$, $\exists$ a morphism $\varphi:\mathrm{Spec}(R)\to\mathrm{Spec}(\mathbb{Z})$.

How? Let $X=\mathrm{Spec}(\mathbb{Z})$, $Y=\mathrm{Spec}(R)$, then $\forall\ \emptyset\neq U\subseteq X$ open, $\mathcal{O}\_X(U)=\mathbb{Z}$, so that we may let $\varphi$ be the map induced by the canonical homomorphism $\mathbb{Z}\to R,n\mapsto \overline{n}=1+\cdots+1$, so that $\varphi(\mathfrak{p}):=\mathfrak{p}^c$. It can be checked that $\varphi$ is continuous, and $\forall\ U\subseteq X$ open, we let $\varphi^\#(U):\mathcal{O}\_X(U)\to(\varphi\_\*\mathcal{O}\_Y)(U)=\mathcal{O}\_Y(\varphi^{-1}(U))$, with $\varphi^\#(U)(n)=\overline{n}\in\mathcal{O}\_Y(\varphi^{-1}(U))$, and it can be checked that this commutes with the restriction homomorphism, and defines therefore a morphism of sheaves.

But how do I check that $\varphi$ is unique? My first thought would be a category theoretic proof; clearly, $\mathbb{Z}$ is initial in the category of commutative rings, and it can be shown that $\mathrm{Spec}:\mathbf{CRng}\to\mathbf{AfSc}$ is a contravariant functor; unfortunately this functor is easily seen not to be faithful(\*), and is therefore immediately not an equivalence of categories. According to wikipedia, if a functor preserves direct/inverse limits, then it maps initial/terminal objects to initial/terminal objects, respectively. Is there an analogous statement for contravariant functors, and does it apply here? Or is there some other way to prove the result?

**\*Edit:** I now realize that statement was incorrect; though two functions might induce the same map on spaces, the maps induced on the entire scheme are nonetheless distinct. My difficulty is now in proving exercise II.2.4 of Hartshorne, which shows essentially that we can define the desired equivalence of categories.