Well is any country in Africa safe? Even the ones with strong central governments? Look at what happaned with South Africa and apartheid.
Except for foreign intervention (esp. Ethipian-backed), Somalia has been relatively safe.
What helps is a homogeneous social structure. They may be clan based but they recognize that they are one nation, so unlike other places in Africa there hasn't been racial tension, ethnic cleansing, massacres, etc.
To get a feel for their sense of nationalism, read the article on "Greater Somalia" on Wikipedia.
A good friend of my fathers had been a doctor here (Dubai) for the past 30 years, and when it came to the legal retirement age (60 years) everyone was shocked that he decided to go back home to Somalia to open a private practice. What was shocking was that he had a green card and all of his adult children are settled in the US.
He explained that he's far more likely to be prosperous in Somalia since doctors are scarce and the market is free and unregulated. He also said it's peaceful where he's from so he's not really afraid for his safety. Can people there afford his services? He says that Somali seafaring traders are doing quite well.
But then again this was several years ago, before the recent turn of events...