Good luck, foxes are notoriously hard to catch and always seem one step ahead.
Best way I’ve found is to get a puppy, and introduce the puppy to the fox at a young age. Over time, they will develop a strong friendship, even though you’ll still be a bit annoyed by the fox hanging around with your ducks/chickens nearby.
As the years go by, your puppy will grow into a strong, loyal, hunting dog.
Eventually, your dog will face an existential crisis, and you just need to hope that their loyalty to your as their owner will outweigh their feelings of friendship to the fox, at which point they will turn on the fox and lead it right into a trap.