Sorry for resurrecting such an old question, but I think we can give a much simpler proof here. We'll reduce the problem from $G$ to the Bohr compactification $B\mathbf{Z}$ of $\mathbf{Z}$, then from $B\mathbf{Z}$ to the profinite completion $\hat{\mathbf{Z}}=\prod_p\mathbf{Z}_p$ of $\mathbf{Z}$, and then we'll argue directly.

Let $\phi:G\to\mathbf{Z}$ be a homomorphism and fix $x\in G$. The map $\mathbf{Z}\to G$ extending $1\mapsto x$ induces a map $B\mathbf{Z}\to G$ such that $1\mapsto x$, and thus we obtain a map $\phi':B\mathbf{Z}\to \mathbf{Z}$ such that $\phi'(1)=\phi(x)$.

Recall that to construct $B\mathbf{Z}$ one takes the dual of $\mathbf{Z}$, namely $\mathbf{R}/\mathbf{Z}$, strips the topology to get the discrete group
$\mathbf{R}_d/\mathbf{Z}\cong\mathbf{R}_d\times\mathbf{Q}/\mathbf{Z}$, then takes the dual again. The result is that $B\mathbf{Z} \cong B\mathbf{R}\times\hat{\mathbf{Z}}$. Since $B\mathbf{R}$ is divisible $\phi'$ must vanish on $B\mathbf{R}$. Since $\prod_{p\neq 2}\mathbf{Z}_p$ is infinitely $2$-divisibile and $\mathbf{Z}_2$ is infinitely $3$-divisible, $\phi'$ vanishes on $\hat{\mathbf{Z}}$. Thus $\phi'$ is identically $0$, so $\phi(x)=\phi'(1)=0$.