The Gemara talks about putting Mezuzos on the gates of cities. I have seen Mezuzos on the gates to the old, walled city of Yerushalayim, but I have not seen them elsewhere.
(a) What is the Halachah today regarding such gates? Does it make a difference whether most of the people in the city are Jewish?
(b) Also, why don't we put up Mezuzos when we make an Eruv (i.e. Tzuras ha'Pesach) around a city or neighborhood?
Aharon Meir Goldstein, Telshe Stone, Israel
(a) There are several points that need to be made in order to answer your first question about gates.
1) A gate only requires a Mezuzah if it leads to a dwelling that itself requires a Mezuzah (Rambam, Hilchos Mezuzah 6:8). For this reason, the only gate of the Azarah of the Beis ha'Mikdash that required a Mezuzah was Sha'ar Nikanor because it led to the Lishkas Parhedrin where the Kohen Gadol lived for seven days before Yom Kipur (Yoma 11a).
2) The gate of a city where both Jews and non-Jews live may or may not be obligated to have a Mezuzah. If a majority of the inhabitants are Jewish, then all opinions agree that it is obligated. If only a minority are Jewish, then we have a dispute between Rashi and the Rashba. Rashi would say that there is no obligation and the Rashba would say that the obligation remains. Their dispute centers around the question of whether a partnership with a non-Jew in a property exempts one from the obligation of Mezuzah. Jews and non-Jews living together in a walled city would be considered partners in the use of the gates to the city. Rashi, commenting on the the Gemara (here) which asks why the gates of the town of Mechuza ("Avuli d'Mechuza") did not have Mezuzos on them, says that most of the inhabitants of the town were Jewish. From that we learn that Rashi holds that a partnership with a non-Jew exempts one from Mezuzah and that the only reason that Mechuza should have had Mezuzos is because a majority of the inhabitants were Jewish and we apply the principal of Rubo k'Kulo (that it is as if the entire population were Jewish). The Rashba (see Beis Yosef, YD 286:1) holds that a partnership with a non-Jew in a property does not exempt one from the obligation of Mezuzah (and therefore there is no reason to assume that most of the inhabitants of Mechuza were Jewish).
Rabbi Akiva Eiger (Teshuvah #66) explains their dispute in the following way: Rashi holds that the property must be completely in Jewish control to be obligated. The Rashba holds that even if the Jew is not in complete control, since he lives there, he still requires a Mezuzah because of the protection that it affords.
The Beis Yosef (above) rules like the Rashba. The Rema (Shulchan Aruch, YD 286:1) rules like Rashi.
3) Even if most of the inhabitants are Jewish, the obligation to place Mezuzos may be waived. The Gemara mentioned above answers, that in Mechuza they did not have to put up Mezuzos because of Sakanah (danger). Rashi explains that since the town was controlled by non-Jews, there was a danger that the Jews would be accused of witch-craft if they were found attaching pieces of parchment with strange writing on it to the town gates. (The Gemara implies that even if the danger was only the risk of heavy financial loss, this would be grounds for being freed from the obligation of Mezuzah). The Shach (Shulchan Aruch, above) mentions the reason of Rashi and then mentions a second reason: that the non-Jews may vandalize the Mezuzah and thereby desecrate Kisvei Kodesh (holy writings). For these reasons, he writes, the gates to the Jewish ghettos of Cracow and Prague did not have Mezuzos.
The question of whether the gates of Yerushalayim need Mezuzos is somewhat complex. Even though most of the inhabitants of the old city are non-Jewish, the old city itself is surrounded by the new city which is mostly Jewish. Why is this significant? Because to determine whether the gates need a Mezuzah, we have to decide who has ownership of the gates; that is, who has control of the gates. In this case we would probably say that the population of the entire city as a whole has ownership of the gates (it is probably the city government that controls the gates). It could be argued though that the country of Israel as a whole is the "owner" of the gates because the national government would have the final say in what is done with the gates. In either case, however, we have a majority of Jews and therefore according to all opinions the gates require Mezuzos. (The actual obligation to buy and affix the Mezuzos rests with the Jewish inhabitants of the old city because a Mezuzah is Chovas ha'Dar (an obligation on the dweller)).
It could be, however, that the gates leading into non-Jewish areas of the old city, for example, Sha'ar Shechem, do not need a Mezuzah. This is because even though there is no Sakana - Boruch HaShem - there is a possibility that the Mezuzah might be vandalized by the non-Jews in that area. According to this reasoning not only is there no obligation, but in fact maybe there shouldn't be a Mezuzah there at all.
Interestingly, Sha'ar Ashpos (the gate leading to the Kosel area) may not require a Mezuzah. The Kosel area may not have any dwellings (apartments where people live and sleep) and therefore by rule 1, would not require a Mezuzah. Even though the Jewish quarter is in the vicinity, people living there probably access their apartments from Sha'ar Yafo or Sha'ar Tzi'on. The Ra'avad (Tamid 30a) says that only a gate which is normally used to access a dwelling is obligated in a Mezuzah. He proves this from the Gemara (here) that says that only Sha'ar Nikanor was obligated to have a Mezuzah, even though there were other gates that led to the Lishkas Parhedrin, because this was the gate that the Kohen Gadol used to go to the Lishkas Parhedrin. Nonetheless, there is a Mezuzah on Sha'ar Ashpos (there is a Yeshivah down on the plaza level which might have dormitories there on site). Finally, Sha'ar Yafo, at least the part that cars drive through, doesn't require a Mezuzah because it is open at the top (i.e. it doesn't have a Mashkof).
(b) To answer the second question about the Tzuras ha'Pesach of an Eruv, we should start by saying that the reality is that traditionally Mezuzas have not been added to the Tzuros ha'Pesach of Eruvim. The question is, why? The Chazon Ish (Hilchos Mezuzah, 172) says that, in fact, one is obligated to place Mezuzos on Tzuros ha'Pesach of an Eruv but that practically one doesn't need to because of the risk of them being vandalized by non-Jews and because of non-Jews living within the Eruv. Neither of these reasons, however, apply to most of the Eruvim in towns and neighborhoods in Eretz Isroel. Other Poskim (see Sefer Chovas ha'Dar 5:1) say that the Tzuras ha'Pesach of an Eruv is intrinsically exempt because the Tzuras ha'Pesach is not made to be used as an entrance and exit but only as a means to define the area Halachically as a private domain. This is certainly true of the Tzuros ha'Pesach which people don't pass through regularly, such as those which parallel the perimeter road of a town, and even to those which are built over a road.
*This reply is not intended as a Psak Halacha. It is only intended as an explanation of the Halachic issues involved in the question.**