At the core, you need to spend more money by basically giving these people healthcare, mental health care, and a place to live.
"But that's not fair, what about all the good, honest citizens of the city who work their asses off to pay the exorbitant rents and exorbitant health insurances and still struggle to put food on the table bla bla bla"
No, it's not fair, but as long as that mentality rules, SF will have a homeless problem. The city sure as fuck doesn't lack the money to solve it, it lacks political will.
"But that's socialism!"
Yes. Now do you want to solve the problem, or keep sticking your head in the sand and hope it goes away through the magic of capitalism and the free market?