Can I set a different default browser for localhost sites?

I'm a web developer and I want to use Brave as my browser for the normal stuff, and Firefox Developer for Web Development.

Currently Brave is my default, but when I do npm run serve or whatever my web dev sites open in it too, whereas I'd like those to open in Firefox Developer.

The difference is basically that webdev sites are always pointing toward localhost, so is it possible to get localhost to open in one browser and everything else in another? (MacBook Pro, Mojave)


There are a few apps that I think might be able to accomplish this.

The first that I would recommend is Choosy ($10, trial available). That's the one that I use. I recommend it first because you can download it and try it before you pay for it.

There's also Browser Fairy which is $5, but it's in the Mac App Store, and there's no trial version available. I own it also, and I think it's good, but I have had Choosy for ages and it continues to work for me, so I've stuck with it.

I would recommend checking out Choosy, and see if it does what you want. You can easily set a default browser and then set exceptions for specific sites, building criteria similar to how you would make a Smart Mailbox in Mail.app.