I try to find handicaps to help nudge me in the right direction. I used to have a bad habit of working for hours without a break, causing pretty severe eye pain. A few months ago, I installed an app called "time out" on mac that forces me to take a break after 20 minutes of working. It was hard at the beginning, but now I've pretty much completely eliminated the bad habit.
Replace them with good habits. It's actually almost impossible to eliminate habits. Especially long-standing ones. The best you can do is avoid the cue or change the routine. I highly suggest reading "The Power Of Habit" or "Atomic Habit."
1. I used to have a huge glass of Mountain Dew with most meals. I created a new habit, singing a little tune as I had the drink: "Mountain Dew, Mountain Dew, it's the drink that's bad for you." It also helped to think about ingredients, particularly the brominated vegetable oil. That did it.<p>2. I used to drive while tired. I crashed. This was effective for eliminating the bad habit, but I can't recommend it.
Two-prong approach: Make it easy to avoid them, and easy to do something else.<p>Don't bring any refined sugar foods into the house. Make fruits available easily.<p>Don't have tobacco around. Make it so I'm always ready to go on a walk.<p>Disable/delete accounts on unhelpful services. Replace their quickmarks with my own websites.
Couple the bad habit with a good habit. Then try to taper the bad habit down until only the good one remains, or live with a modest reduction in the bad habit.
getting a dumb phone...<p>And I guess the principle in this to make good habits easier and bad habits harder, thus by getting a dumb phone wasting 3 hours a day looking memes became harder and picking up my guitar or ham radio easier.