How to lose attachment?

How do I lose attachment to someone who is clearly no good for me? He is selfish, a liar, and a cheater. Not sure why I keep having him in my life. He's immature as well. Any suggestions?