Tell all freedom loving Somalies to leave Somalia as soon as they can, and give them some time to do that, and even help them do that, but also tell them that at some point in time Somalia will be no more.
A country that continues to be a dysfunctional state as long as that has been true of Somalia - decades - is a country that cannot be governed. The bad parts are so endemic that each succeeding new start is filled with enough bad parts to descend the land back into the chaos.
There is no cure. Somalies have to go where better governments will control their worst instincts and not let them bring their chaos with them.
Stop giving Somalia (and the other countries there) money & free stuff and the problems will solve themselves.