If it were me, I'd withdraw from the child, but not silently without explaining yourself of course. Both of my children went through a phase where they were abusive, acting violently and saying mean things. In the case of my children, they were younger and their behavior could somewhat be excused because they were opting for expressing themselves in outbursts instead of through proper communication and had yet to learn this lesson.
In the case of your son, while he may not know how to perfectly express himself, you can't just fall back on this to excuse his actions because he is old enough to know that this behavior is entirely inappropriate.
Back to my children, despite their age, they still got the same treatment and it was highly effective. If one child was hitting another, I would come get the child being hit and take them away to do an activity with them alone, and explain to the abuser that we don't want to be around them because they are being mean and hurting us. Follow up the criticism with the right thing to do of course, explaining that if they weren't doing X, we could all be happy together. Half-hearted apologies were not accepted, the separation was enforced until a real change of behavior happened.
When I say enforced, I mean fully enforced. When my children were going through this phase, if they insulted or hit their mother, guess what? No more lullabies at night, no more of moms baking, no perks from the person being abused whatsoever. When things were really bad, we'd set up a table for them to eat at alone, because they don't get to be around people they habitually assault verbally or physically. If you're mean and treat them like garbage, you deserve nothing from them.
Provide essentials of course (as not doing so would be abuse) but all the perks, gone. He's 12, maybe he can do his own laundry, or can fix himself sandwich for lunch, no more rides to the sports he loves to play etc. Maybe some of those options are not appropriate depending on his own stage of development, but you'll know best which are.
This can feel harsh and some might think it's a bad idea because you're not addressing the underlying issues that are causing the child to act out this way. It is true that they need to be addressed, but they certainly cannot be addressed at all while the child is exhibiting a complete disregard for your position as a parent and the mental and physical health of your entire family.
No matter how angry or hurt, everyone wants to be accepted, especially by those closest to them. Make sure that you convey that you love them, ask them why they are hurting you, lay on the guilt, then separate yourself. The separation serves the purpose of protecting yourself and the rest of your family from severe abuse, while giving them time to dwell on their actions after the entire family has unified to condemn the actions.
This must be done in a very carefully balanced way. You must appear united and strongly condemning this behavior, but it must be abundantly clear that you desire nothing more than to fold them back in. Note "being mean" not "are mean" - don't condemn the child, condemn the actions and let them know they are better than that. Not making this distinction will tell them that they are not better than that. All the best.