The Doctor states this in "Forest of the Dead" but to date the exact circumstances have not been revealed. It was first thought that it was upon marriage, but in "The Wedding of River Song" we find this not to be the case. In "The Name of the Doctor", it is suggested that the Doctor's real name must be uttered in order to open the TARDIS-as-crypt on Trenzalore; earlier in the episode River Song confirms that she "made" the Doctor tell her his real name. Under what circumstances is not revealed. In "The Time of the Doctor" the Doctor's real name is considered the trigger to bring Gallifrey back from the "pocket universe" to which it had been sent in "The Day of the Doctor". On top of all this, the Doctor's real name is easily accessible within a book Clara finds in the TARDIS library in "Journey to the Centre of the TARDIS".
All this implies that, while at the time of "Forest of the Dead" the Doctor was of the belief there was only one circumstance in which he'd utter his true name, since then several other circumstances have manifested themselves.