The Gemara (Menahot 34b) discusses that the box of the Tefilin Shel Rosh and Shel Yad contain four compartments, each with a different portion from the Torah.. These four portions are “Kadesh Li”, “Vehaya Ki Yeviacha”, “Shema Israel” and “Vahaya Im Shamo’a”. Rashi interprets the Gemara as saying that the order of these portions is as they appear in the Torah, that is, in the aforementioned order. Rabbenu Tam, on the other hand, says that “Kadesh Li” and “Shema Israel” should be in the outer compartments and both portions that begin with “Vehaya” should be next to each other in the inner compartments.
|והיה אם שמוע||שמע||והיה כי יביאך||קדש|
|שמע||והיה אם שמוע||והיה כי יביאך||קדש|
It is important to note that although this disagreement is commonly attributed to Rashi and Rabbenu Tam, it existed much earlier. In fact the Zohar cites an opinion in the Talmud Yerushalmi which is in accordance with the opinion commonly attributed to Rabbenu Tam. The Rambam (Shu”t HaRambam, § 19) writes that the Rif was influenced by the writings of Rabbi Moshe bar Maimon (not the Rambam), who wrote like Rabbenu Tam’s opinion. Afterwards, a certain Rabbi Deri travelled from Morocco to Israel, and taught that the Tefilin should be like the opinion attributed to Rashi, and thus the Rambam ruled as such.
Due to this long standing disagreement, the Shulhan Aruch (O.H. 34:2-3) says that both types of Tefilin should be donned, but only by those who are Gd-fearing and that are known to be pious. If one is not of such a spiritual caliber, donning both types of Tefilin may seem haughty, as though one is trying to appear overly religious.
In Morocco, there was a general awareness about appearing haughty and thus Rabbenu Tam Tefilin were not commonly worn. Some rabbis would wear them, but would do so privately. Rabbi Shalom Messas (Tevuot Shamesh) writes that even though it was not common even among rabbis, he wished to be stringent and adopt the custom of wearing Tefilin of Rabbenu Tam. At the age of thirty, he became sick with typhus and attributed it as being a heavenly sign that he was acting arrogantly by adopting this practice, and stopped doing it altogether.
That said, the HIDA (Mahzik Beracha), is of the opinion that nowadays wearing Rabbenu Tam Tefilin in addition to Rashi Tefilin is not considered haughty. Indeed, it is not uncommon for people to don both types of Tefilin, and Rabbi Ovadia Yosef was a proponent of this practice. As such, Rabbi Elyashiv and others are known to have said that since it is more common, one need not be concerned about appearing overly religious or haughty and one can take on this practice.
Rabbi Ben Zion Abba Shaul (Or Lezion, vol. II) writes that an unmarried man should not don Tefilin of Rabbenu Tam since one may have impure thoughts. This is based on the Shulhan Aruch (O.H 38:4), which says that one’s thoughts must not have lustful thoughts while wearing Tefilin. A married man, on the other hand, is considered to have attained a level at which one’s thoughts are more controlled and thus is fit to wear both types of Tefilin. Nevertheless, Rabbi Ovadia Yosef (Halichot Olam) says that a single man may wear Tefilin of Rabbenu Tam as long as he is sure that he can control his thoughts.
Summary: The Moroccan custom was for lay people to not wear Tefilin of Rabbenu Tam. If one wishes to take on this practice, one need not be concerned about appearing haughty.