Question: Is it true that one should not tell others when they see a rainbow?
Answer: The Gemara (Berachos 59a) teaches that one recites a beracha upon a seeing a rainbow, recalling the bris that Hashem made with Noach, and His assurance that the world would never undergo such a mabul again. The Shulchan Aruch (OC 229:1) writes that one should not stare at the rainbow (See Beis Yosef OC 229:1 where he quotes the Rosh). The Gemara (Chagiga 16a) teaches that looking at a rainbow is considered disrespectful to Hashem and that doing so can weaken one’s eyesight. The Pri Megadim (Eshel Avraham OC 229:2) asks why the Magen Avraham (229:2 and Baer Hetiv OC 229:2) quotes the Shela as saying this when this teaching can be found in the Gemara.
Thus, the Mishna Berura (229:5), Aruch Hashulchan (OC 229:2) and Kaf Hachaim (OC 229:5) stress that one should look briefly and then recite the beracha.
The Chayei Adam (63:4) writes that he once saw in a sefer that one who sees a rainbow should not tell their friend as it is akin to reporting bad news (See Mishna Berura 229:4). He adds that he does not remember where he read this, however. Nonetheless, the Mishna Berura (229:1) and Kaf Hachaim (OC 229:1) quote this unequivocally.
However, the Sefer Chassidim discusses whether it is appropriate to leave shul during chazaras hashatz when hearing about a rainbow, without any mention of such restrictions. R’ Moshe Cohen (Bris Kehuna OC 100:4) argues that one should tell others when they see a rainbow. Rather than being seen as something negative, the rainbow should inspire us to be grateful for being spared. Additionally, by telling others, one is giving them an opportunity to recite a beracha (See Yalkut Yosef OC 229:1).
In conclusion, while many refrain from telling others when they see a rainbow, there are compelling reasons to do so.