Ghalib was the son of the Emir of Mecca
Musa'id ibn Sa'id (r. 1752-1770). After Musa'id's death the Emirate was held by Ghalib's uncle
Ahmad ibn Sa'id (r. 1770-1773), then his brother
Surur ibn Musa'id (r. 1773-1788). After Surur's death on 18 Rabi al-Thani 1202 AH (c. 27 January 1788), his brother
Abd al-Mu'in assumed the Emirate. However, he reigned for only a day or part of a day (or a few days, according to some sources) before abdicating in favor of Ghalib. News of Surur's death reached
Istanbul in mid-Sha'ban (May 1788), and Sultan
Abdul Hamid I confirmed Ghalib's appointment. The imperial
firman (proclamation) and ''
khil'ah'' (robe of honor) arrived in Mecca on 29 Dhi al-Qi'dah 1202 AH (c. 1 September 1788). ==Conflict with his brothers==