6. If $n$ is a positive integer and satisfies
$$
(n-1)^{2} \mid\left(n^{2013}-1\right) \text {, }
$$

then the number of possible values of $n$ is ( ).
(A) 2
(B) 4
(C) 6
(D) 8
6. D.

Notice,
$$
\begin{array}{l}
(n-1)^{2} \mid\left(n^{2013}-1\right) \\
\Rightarrow(n-1) \mid\left(n^{2012}+n^{2011}+\cdots+n^{2}+n+1\right) \\
\Rightarrow(n-1) \mid\left[\left(n^{2012}-1\right)+\left(n^{2011}-1\right)+\cdots+(n-1)+2013\right] \\
\Rightarrow(n-1) \mid 2013 .
\end{array}
$$

Since $2013=3 \times 11 \times 61$, 2013 has 8 divisors, and each divisor plus 1 is the $n$ that meets the condition.