Is residing near Mecca permissible?
Chapter on Ransom (Fidyah) and Penalty for Hunting
Al-Mughni
Book of Hajj
Primary text
Residing near Mecca is permissible. The Prophet, peace be upon him, stated that Mecca is the most beloved place to Allah, and he would not have left it had he not been expelled. Residing in Mecca is only disliked for one who emigrated from it. Companions such as Jabir ibn Abdullah resided there, and the people of other regions and those from Yemen are not in the same category as those who emigrated and were later expelled. Ibn Umar also resided in Mecca.
Supporting text
Residing in Medina is preferred over residing in Mecca for those who are able, because Medina is the place of Hijra (emigration) for the Muslims.