Ghalib, an ethnic [[Bugis]], was born in [[Bone Regency|Bone]] in the present-day province of [[South Sulawesi]] on 3 June 1946.<ref name=tempo/><ref name=asiaweek/> He was a native of [[Ujung Pandang]], [[South Sulawesi]].<ref name=asiaweek/>
On 15 June 1998, Indonesia's new President [[B. J. Habibie]] fired Indonesia's [[New Order (Indonesia)|Suharto-era]] Attorney General, [[Sujono Atmonegoro]], and appointed Maj. Gen. Andi Muhammad Ghalib isas the country's new Attorney General.<ref name=nytimes>{{cite news|title=World News Briefs; Indonesia's New Leader Ousts Attorney General |url=https://www.nytimes.com/1998/06/16/world/world-news-briefs-indonesia-s-new-leader-ousts-attorney-general.html |work=[[The New York Times]] |date=1998-06-15 |access-date=2016-06-07}}</ref> Ghalib has been serving as the director of the [[Indonesian National Armed Forces]]' law office at the time of his appointment.<ref name=asiaweek/> Ghalib was Attorney General of Indonesia within President Habibie's [[Development Reform Cabinet]] from June 1998 until June 1999.<ref name=tempo/><ref name=nytimes/>
However, on 3 June 1999, which coincided with Ghalib's 53rd birthday, [[Teten Masduki]], the then-head of [[Indonesia Corruption Watch]] (ICW), released an investigation thatwhich alleged that Ghalib and his wife had deposited an estimated 9 billion [[rupiah]] ($1.2 million), which was given by Indonesian [[tycoon]]s and businessmen, in nine different bank accounts between September 1998 and May 1999.<ref name=asiaweek/> Ghalib announced that he would temporarily step down as Attorney General on 14 June 1999, with a letter of resignation dating from 9 June.<ref name=asiaweek/><ref name=wsj>{{cite news|first=Jeremy|last=Wagstaff|title=Indonesia's Ghalib Steps Down Amid Growing Bribery Scandal |url=https://www.wsj.com/articles/SB929387639579497694 |work=[[The Wall Street Journal]] |date=1999-06-15 |access-date=2016-06-07}}</ref><ref name=jpost>{{cite news|title=Habibie OKs Ghalib resignation bid |url=http://www.thejakartapost.com/news/1999/06/15/habibie-oks-ghalib-resignation-bid.html?1 |work=[[Jakarta Post]] |date=1999-06-15 |access-date=2009-05-17|archive-url=https://web.archive.org/web/20090517133353/http://www.thejakartapost.com/news/1999/06/15/habibie-oks-ghalib-resignation-bid.html?1 |archive-date=2009-05-17|url-status=dead}}</ref>
From 2008 until 2013, Ghalib served as the [[Ambassador]] of Indonesia to [[India]].<ref name=tempo/>