6. Let the sum of the digits of a positive integer $m$ be denoted as $S(m)$, for example, $S(2017)=2+0+1+7=10$. Now, from the 2017 positive integers $1,2, \cdots$, 2017, any $n$ different numbers are taken out, and among these $n$ numbers, eight different numbers $a_{1}, a_{2}, \cdots, a_{8}$ can always be found such that $S\left(a_{1}\right)=S\left(a_{2}\right)=\cdots=S\left(a_{8}\right)$. Then the minimum value of the positive integer $n$ is ( ).
(A) 185
(B) 187
(C) 189
(D) 191
6. A.

Notice that, among $1,2, \cdots, 2017$, the minimum sum of digits is 1, and the maximum sum is 28.

It is easy to see that the numbers with a digit sum of 1 are $1, 10, 100, 1000$; the numbers with a digit sum of $2,3, \cdots, 26$ are no less than eight; the numbers with a digit sum of 27 are only 999, $1899, 1989, 1998$; and the number with a digit sum of 28 is only 1999.

Furthermore, taking seven numbers from those with a digit sum of $2,3, \cdots, 26$, and taking all the rest, does not satisfy the condition.
Therefore, $n \geqslant 4+7 \times 25+4+1+1=185$.
By the pigeonhole principle, we know that when $n=185$, the condition is satisfied.

In conclusion, the minimum value of the positive integer $n$ is 185.