Halacha 1
There are ten requirements that must be met by a house for the person who dwells within to be obligated to affix a mezuzah. If one of the requirements is lacking, there is no obligation for a mezuzah. They are:
a) for the area [of the dwelling] to be four cubits by four cubits or more;
b) for it to have two doorposts;
c) for it to have a lintel;
d) for it to have a roof;
e) for it to have doors;
f) for the entrance to be at least ten handbreadths high;
g) for the dwelling not to be consecrated;
h) for it to be intended for human habitation;
i) for it to be intended to be used for a dignified dwelling;
j) for it to be a permanent dwelling.
Halacha 2
A dwelling which is less than four cubits by four cubits does not require a mezuzah. If its area is equal to sixteen square cubits, although it is circular, pentagonal, and needless to say, if it is rectangular, since its area is equal to the above-mentioned figure, it requires a mezuzah.
Halacha 3
An excedra, a structure with three walls and a roof, does not require a mezuzah even though it has two pillars on the fourth side. The pillars are intended as supports for the roof, and not as doorposts.
Similarly, a roof without walls which stands on pillars, even though shaped like a house, does not require a mezuzah, because it has no doorposts. The pillars are intended to support the roof.
Halacha 4
[The following rules apply to] a house which has a doorpost on either side and an arch above the two doorposts instead of a lintel. If the doorposts are ten handbreadths high or more, it requires a mezuzah. If they are not ten handbreadths high, [the entrance] does not require [a mezuzah], because it does not have a lintel.
Halacha 5
A house that does not have a roof does not require a mezuzah. If a portion of [a building] was covered by a roof and a portion was not, the [following ruling] appears to me [as appropriate]: If the covered portion is near the entrance, it requires a mezuzah.
The doors should be attached, and afterwards, a mezuzah affixed.
Halacha 6
[The gates to] the Temple Mount, its chambers, courtyards, and, similarly, entrances to synagogues and houses of study which do not have apartments in which people live do not require mezuzot, because they are consecrated.
A synagogue in a village in which guests reside requires a mezuzah. Similarly, a synagogue in a metropolis, if it has an apartment, requires a mezuzah.
All the gates in the Temple complex did not have mezuzot, with the exception of the Gate of Nicanor and those further within, and the entrance to the Chamber of Parhedrin, because this chamber served as a dwelling for the High Priest during the seven days when he was separated [from his home in preparation for the Yom Kippur service].
Halacha 7
A storage house for straw, a barn for cattle, a woodshed, or [other] storage rooms do not require a mezuzah [as can be inferred from Deuteronomy 6:9, which requires that a mezuzah be placed on] "your homes" - i.e., a house which is set aside for your use - thus excluding the above and their like.
Therefore, [if] a barn [is also used] by women as a dressing room, it requires a mezuzah, since it is used as a dwelling by a human being. A guardhouse, an excedra, a porch, a garden, and a corral do not require a mezuzah since they are not dwellings. If dwellings which require a mezuzah open up to these structures, they require a mezuzah.
Halacha 8
Accordingly, gates to courtyards, gates to alleys, and gates to cities and towns, all require a mezuzah, since houses which require a mezuzah open up to them. Even when there are ten structures leading one to each other, should the innermost one require a mezuzah, they all require [mezuzot]. Therefore, [our Sages] stated: A gate which opens up from a garden to a courtyard requires a mezuzah.
Halacha 9
A toilet, a bathhouse, a mikveh, a tannery, and the like, do not require a mezuzah, since they do not constitute a dignified dwelling.
A sukkah on the holiday of Sukkot, and a house on a ship do not require a mezuzah, for they do not constitute a permanent dwelling.
[With regard to] the two booths of a potter, one inside the other: The outer booth does not require a mezuzah, because it is not a permanent structure. Stores in a market place do not require a mezuzah because they are not permanently used as a dwelling.
Halacha 10
A dwelling which has many doorways requires a mezuzah for each and every doorway, even though one generally enters and leaves through only one of them.
A small entrance between a dwelling and a loft requires a mezuzah. When there is a separate room in a house, or even one room which leads to another room, it is necessary to affix a mezuzah on the doorway to the innermost room, the doorway to the outer room, and the doorway to the house, since all of them are used for the purpose of dwelling and are permanent structures.
Halacha 11
When a person frequently enters and leaves through an entrance between a synagogue and a house of study and his own house, that entrance requires a mezuzah.
When there is an entrance between two houses, [the position of the mezuzah] is determined by the door-hinge. The mezuzah is placed on the side on which the hinge can be seen.
Halacha 12
Where is the mezuzah affixed? At the inside of the entrance, within a handbreadth of the outer edge of the doorpost, at the beginning of the top third of the entrance. If it was affixed higher up, it is acceptable as long as it is at least a handbreadth below the lintel.
It must be placed at the right-hand side as one enters the house. If it is placed on the left-hand side, it is invalid.
A house belonging to partners requires a mezuzah.
Halacha 13
A person must show great care in [the observance of the mitzvah of] mezuzah, because it is an obligation which is constantly incumbent upon everyone.
[Through its observance,] whenever a person enters or leaves [the house], he will encounter the unity of the name of the Holy One, blessed be He, and remember his love for Him. Thus, he will awake from his sleep and his obsession with the vanities of time, and recognize that there is nothing which lasts for eternity except the knowledge of the Creator of the world. This will motivate him to regain full awareness and follow the paths of the upright.
Whoever wears tefillin on his head and arm, wears tzitzit on his garment, and has a mezuzah on his entrance, can be assured that he will not sin, because he has many who will remind him. These are the angels, who will prevent him from sinning, as [Psalms 34:8] states: "The angel of God camps around those who fear Him and protects them."
Blessed be God who offers assistance.
There are ten requirements that must be met by a house for the person who dwells within to be obligated to affix a mezuzah. - The Rambam's choice of phraseology emphasizes the concept mentioned in the previous halachah: that the mezuzah is the obligation of the dweller and not the dwelling.
If one of the requirements is lacking, there is no obligation for a mezuzah. - It appears that all these requirements are mid'oraita, postulated by Torah law.
They are: a) for the area [of the dwelling] to be four cubits by four cubits or more; - See Halachah 2.
b) for it - the entrance
to have two - Note the Turei Zahav 287:1 and the Kitzur Shulchan Aruch 11:11, which state that if an entrance has a doorpost on the right side and a wall which continues on the left side, a mezuzah should be affixed without a blessing. If the doorpost is on the left side, and the wall continues on the right, there is no need for a mezuzah.
doorposts; - According to most authorities, the doorpost need not be an addition to the walls of the house. Even if the entrance to the house does not have a frame attached to it, but rather the wall of the house itself serves as the doorpost attached to it, a mezuzah is required. Note the statements of the Turei Zahav 287:1. (See also Halachah 3.)
c) for it - the entrance
to have a lintel; - a beam above the doorposts. According to many authorities, the ceiling of the house is not considered to be a lintel. (See also Halachah 4.)
d) for it - the dwelling
to have a roof; - See Halachah 5.
e) for it - the entrance
to have doors; - The Ra'avad, Rabbenu Asher, and others differ with the Rambam's opinion. In a responsum attributed to the Rambam, his view is explained as follows: The Torah states that a mezuzah should be placed "on your gates." This expression implies an entrance with doors.
The Shulchan Aruch (Yoreh De'ah 286:15) obligates us to place a mezuzah even on entrances which do not have doors. Nevertheless, in deference to the Rambam's opinion, the Siftei Cohen 286:25 states that a person should not recite a blessing when affixing such a mezuzah. (See also Halachah 5.)
f) for the entrance to be at least ten handbreadths high; - If the entrance is not at least this high, it is not fit to be used by adults. (See also Halachah 4.)
g) for the dwelling not to be consecrated; - See Halachah 6.
h) for it to be intended for human habition; - This principle is not accepted by all authorities. See Halachah 7.
i) for it to be intended to be used for a dignified dwelling; - See Halachah 9.
j) for it to be a permanent dwelling. - See Halachah 9.