He stayed in Makkah for six months after Hajj, then he went to Madinah; does he have to do tawaaf al-wadaa‘ (farewell tawaaf)?
If you were one of the residents of Makkah – as you say – and you stayed in Makkah after completing Hajj, then you do not have to do the farewell tawaaf. But if you want to leave Makkah, then you have to do tawaaf.
An-Nawawi (may Allah have mercy on him) said: Our companions said: If a person has completed the rituals of Hajj and wants to stay in Makkah, he does not have to do the farewell tawaaf. This is a matter concerning which there is no difference of scholarly opinion, regardless of whether he is one of its people or a stranger. But if he wants to leave Makkah to go back to his homeland or elsewhere, he should do the farewell tawaaf.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said: If a man is one of the people of Makkah and he does Hajj and travels after Hajj, he should do the farewell tawaaf, because the Prophet (blessings and peace of Allah be upon him) said: “No one should leave until the last thing he has done is to circumambulate the House.” Muslim (1327). This is general in meaning, therefore we say to this Makkan: So long as you are travelling during the days of Hajj and you have done Hajj, you should not leave until you have circumambulated the Ka‘bah (tawaaf). End quote.
Majmoo‘ Fataawa Ibn ‘Uthaymeen (23/339)
Based on that, you should have done the farewell tawaaf before travelling to Madinah. If you did not do tawaaf, then you have to sacrifice a sheep in Makkah and distribute its meat to the poor.
Shaykh ‘Abd al-‘Azeez ibn Baaz (may Allah have mercy on him) said: Whoever omits the farewell tawaaf or a circuit of it must offer a sacrifice, to be slaughtered in Makkah and its meat distributed to the poor there. End quote.
Majmoo‘ Fataawa ash-Shaykh Ibn Baaz (16/158)
And Allah knows best.