I have set default browser under settings to Firefox so running open 'https://google.com' opens up firefox but running sudo open 'https://google.com' will still open safari browser

I have commands that require sudo user.

How do I change root default browser to use firefox? Clearly this should be an option

Os: ventura 13.6 / M2 Pro 2023

  • 1
    If you document how you changed the open application for your user it might provide a better answer and also teach others that trick :) no need to edit the question, just a suggestion to improve it for everyone
    – bmike
    Commented Oct 27, 2023 at 13:27

1 Answer 1


When you run the open with sudo you are running as root. This means that Safari is launched by default.

To circumvent this, as the -a option to open thusly:

sudo open -a /Applications/Firefox.app https://google.com

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .