Showing a UFD which is not a PID must have a nonprincipal maximal ideal. Given that $R$ is a UFD which is not a PID, I want to show that $R$ must have a nonprincipal maximal ideal.
I tried several methods, including Zorn's lemma but didn't get anywhere. Any suggestions would be appreciated.
 A: Case 1. Let $R$ be a non-Noetherian UFD where all of its maximal ideals are principal, then it is a PID.
Assume the contrary and let $I$ be an ideal which is maximal w.r.t being non-principal, then $I$ is a prime ideal (Look at the Theorem 1.4. for more detail.) By assumption, $I$ cannot be maximal, thus there is a maximal ideal $m=(x)$ containing $I$ properly (note that $x$ is an irreducible element.) Now, $m \subseteq I+m \subseteq R.$
If $m=I+m,$ based on assumption, any prime ideal contains a prime element (See this). Let $i \in I$ be a prime element, then $xt=i+xr$ for some $t,r \in R,$ then $i=x(t-r).$ Obviously, $i$ cannot divide $x$ so $t-r=is$ for some $s \in R.$ Therefore, $i=x(t-r)=xis$ implying that $x$ is a unit which a contradiction.
If $I+m=R$ i.e. $is+xr=1$ for $i \in I,$ and $s,r \in R.$ Now, $i \in (x),$ or $i=xt$ for some $t \in R.$ Thus, $x(ts+r)=1$ implying that $x$ is a unit element, which is again a contradiction. Hence such an $I$ does not exist and we're done.
Case 2. Let $R$ be a Noetherian UFD where all of its maximal ideals are principal, then it is a PID.
Assume not, and let $I$ be the prime ideal above contained in a principal maximal ideal $m=(x)$ Since $R$ is a Noetherian UFD then any height one prime ideal is principal, therefore, $ht(I) \geq 2$ implying that $ht(m) \geq 3,$ hence is a contradiction, by Krull's principal ideal theorem.
Addendum:
You can see another short proof below by Pete L. Clark. In fact, I was not aware of the fact that Kaplansky's theorem (as mentioned, 15.1 here) holds for all domains.
A: Let $R$ be a UFD in which each maximal ideal is principal, and let $I$ be a nonzero ideal of $R$.  Let $(x)$ be the greatest common divisor of all the nonzero elements of $I$, so $I = (x)J$, where $J$ is an ideal which is contained in no proper principal ideal.  But then by our assumption $J$ is contained in no maximal ideal, so $J = R$ and $I = (x)$.  
Added: Let me address why gcds of arbitrary sets of elements exist in a UFD.  Let $R$ be a UFD and let $\mathcal{P}$ be the set of nonzero principal prime ideals of $R$, so that for all nonzero $x \in R$, $x = \prod_{p \in \mathcal{P}} p^{n_p(x)}$, where each $n_p(x) \in \mathbb{N}$ and all but finitely many are zero.  For any subset $S = (x_s)$ of nonzero elements of $R$, the greatest common divisor of the elements of $S$ is $\prod_{p \in \mathcal{P}} p^{\min_{s \in S} n_p(x_s)}$: this exists!  (In fact there is a finite subset $T \subset S$ such that $\operatorname{gcd}(S) = \operatorname{gcd}(T)$.)
