The Gemara states that when one rents a dwelling, he only becomes obligated after thirty days.[1] The obligation in a rental is of rabbinical origin. [Note: This Gemara is referring to a dwelling outside Israel. In Israel, one is obligated even on the first day of rental. However, one who stays in a hotel — even for a month at a time — is exempt from Mezuzah.[2]]
Rashi explains that until thirty days have elapsed, one can easily change his mind about the rental; thus, the house is not really “his” until thirty days are over. Tosafot explain that the first thirty days of residence are considered as “temporary dwelling,” and temporary dwelling does not obligate one to affix a mezuzah.
Based on Rashi’s explanation, it follows that when a long-term contract is signed which legally obligates the renter for an extended period, the obligation of mezuzah would take effect immediately. Moreover, if upon moving into the house, the renter improves the dwelling in a manner which shows that he is planning to remain there for a long while, logic dictates that a mezuzah should be put up and the proper blessing recited.
Consequently, the custom has developed to put up mezuzot immediately. Some authorities allow a berachah to be recited at that time. One can rely on this view.[3]
However, some poskim advise that though the mezuzah should be affixed immediately upon moving in, the blessing should not be recited until the thirty-day period is up. R. Moshe Feinstein rules that the mezuzah need not be removed and replaced at that time. One may merely place his hand on the mezuzah and recite the blessing.[4]
There are authorities that opine that it is proper at that time to remove just one mezuzah, recite the blessing, and return the mezuzah to its proper place. If the thirty-day period concludes on Shabbat or Yom Tov, the mezuzah should be affixed on Friday, erev Shabbos or on erev Yom Tov before lighting candles. The blessing can be recited at that time.[5]
[1] Menachos 44a.
[2] AgurB’ohalecha 30:1. The reason for these distinctions is, as Rashi explains, that Sages wanted to encourage that houses in Eretz Yisrael have mezuzot, to promote its occupation and development. This does not apply to a hotel, which will always be a temporarily occupied.
[3] Chayei Adam 15:22; Aruch HaShulchan 286:49, cited in R. Doniel Neustadt, The Mitzvah of Mezuzah, Torah.org (http://tinyurl.com/p7jevhg); Agur B’ohalecha cites Igros Moshe Y.D. 1:179, Minchas Yitzchak 10:93, and Mezuzot Beitecha 286:76.
[4] Igros Moshe Y.D. 1:179.
[5] The Mitzvah of Mezuzah, Torah.org (http://tinyurl.com/p7jevhg); See, however, Agur B’ohalecha 7:5, citing Shach 286:25; Aruch HaShulchan 286:24; Sha’arei HaMezuzah, citing oral ruling of Shevet HaLevi.