If you remove the --args it seems to work fine, since --args can only affect things on first launch (it changes what main gets called with)

Answer from cobbal on Stack Exchange
🌐
OS X Daily
osxdaily.com › 2011 › 07 › 18 › open-url-default-web-browser-command-line
Open a URL in the Default Browser from the Command Line
July 25, 2015 - Using the command line open tool, you can immediately launch any URL from the Terminal into the default web browser of Mac OS X. In other words, you’re launching the specified site into a GUI…
🌐
Super User
superuser.com › questions › 1531606 › open-url-from-command-line-with-default-input-using-macos
Open URL from command line with default input using MacOS - Super User
March 10, 2020 - What I try to do is 1. MacOS terminal, I will input command line like below · open -a "/Applications/Google Chrome.app" 'http://translate.google.com' --input "myWebInput" I am expecting it returns an opened URL, with my input ready in the input box, and the translation is ready there
🌐
Jun711 blog
jun711.github.io › home › productivity
How to Open Websites On A Web Browser Using A Command on Mac (OSX)? | Jun711 blog
April 13, 2019 - 2) To open a website using your default web browser, you can use open YOUR_URL command.
🌐
nootrix
nootrix.com › home › mac os x bug and workaround to open a “file:” url with parameters from command-line
Mac OS X Bug and Workaround to Open a "file:" URL with Parameters from Command-Line - nootrix
July 28, 2021 - But, my goal is to do it from the command line. The following command lines show how to open a file: URL with parameters in Firefox and Google Chrome. The full URL made it to the address bar, and parameter value was displayed. /Applications/Firefox.app/Contents/MacOS/firefox "file:/tmp/readUrlParameters.html?q=PharoJS"
Find elsewhere
🌐
Howchoo
howchoo.com › macos › open-google-chrome-terminal-macos
Open Google Chrome Terminal Macos – howchoo
/Applications/Google Chrome.app/Contents/MacOS/Google Chrome --profile-directory=Profile 5 · I know its not realistic to type this every time you want to open a URL.
🌐
Macworld
macworld.com › home › software › how-to
Quickly open unlinked URLs in Terminal | Macworld
January 5, 2023 - It could come in handy if, for example, you use Terminal to look at Read Me files or other text documents. The trick? Hold down the Command key as you double-click on the URL. That’s it! And it works even if the URL you encounter lacks the http:// portion; Command-double-clicking on ...
🌐
Better Programming
betterprogramming.pub › how-to-open-browser-tab-from-the-command-line-on-mac-52744abb4905
How to Open Browser Tab From the Command Line on Mac | by Code & Coins | Better Programming
March 23, 2022 - Much like other commands, you can simply type the command without any options (-LETTER) and click enter-the help should pop pop up. In the help, it says that open -a ‘Opens with the specified application’. This just tells the open command ...
🌐
Apple Community
discussions.apple.com › thread › 254913756
Clickable hyperlinks in Terminal.app on z… - Apple Community
June 8, 2023 - Command-Double-Click a URL will also open the URL in the default web browser. Either of these can be very useful if you want to quickly follow any URL in a text document. Right-Click with the mouse over an email address, and you will be given the option to compose a new email message in the ...
🌐
How2s
how2s.org › home › tech tips › how to open a browser with a specific url from the command line on mac
How to Open a Browser with a Specific URL from the Command Line on Mac - How2s.org
November 23, 2025 - Replace Browser Name with the name of the web browser you wish to open (Safari, Google Chrome, Firefox, etc.) and replace http://www.example.com with your desired URL. As an example, let's say you want to open Google Chrome to the website https://www.google.com. You would type the following command into your terminal: ... Once you press Enter, Google Chrome should open and navigate to Google's homepage.
Top answer
1 of 3
30

From: Terminal command to open URL's in default and non-default browser (which I don't think is a duplicate)

If you want to open Chrome to a specific URL, just run

google-chrome www.example.com

To open your default browser to a specific URL, run

xdg-open www.example.com  

If you need to run Chrome and close the terminal window afterward, run

google-chrome http://www.google.com </dev/null >/dev/null 2>&1 & disown

>/dev/null 2>&1 will prevent messages from the browser to be outputted to the terminal's window; & will put the process into the background and disown will remove the job / process from the job list, preventing a SIGHUP signal to be propagated to it.

To do this with another browser simply replace google-chrome with that other browser's executable name.

2 of 3
5

sensible-browser seems to be the option you're looking for. This will run the web browser set as default on your system, you can also pass parameters on it in order to run the web browser and open the given website(s).

Usage:

In a terminal, drop the next and hit Return

sensible-browser

Passing parameters:

The next command will open youtube.com in your preferred web browser:

sensible-browser youtube.com

How to set my favorite web browser flavour from the terminal?

Simply drop the next command in a terminal, hit Return and choose wisely:

sudo update-alternatives --config x-www-browser

In the next example I am choosing luakit as my default browser. You can change your default web browser as many times as you wish.

geppettvs@T400:~$ sudo update-alternatives --config x-www-browser
There are 5 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                           Priority   Status
------------------------------------------------------------
* 0            /usr/bin/google-chrome-stable   200       auto mode
  1            /usr/bin/firefox                40        manual mode
  2            /usr/bin/google-chrome-stable   200       manual mode
  3            /usr/bin/konqueror              30        manual mode
  4            /usr/bin/luakit                 10        manual mode
  5            /usr/bin/xlinks2                69        manual mode

Press enter to keep the current choice[*], or type selection number: 4
update-alternatives: using /usr/bin/luakit to provide /usr/bin/x-www-browser (x-www-browser) in manual mode

Unattaching from terminal

If you wish to keep your web browser running just after you close your terminal, simply add an ampersand symbol at the end of your command:

sensible-browser [parameters] &

Good luck!

🌐
JONATHANS BLOG
jonathansblog.co.uk › how-to-open-a-url-from-mac-osx-terminal
How to open a url from mac osx terminal - Jonathans blog
July 28, 2013 - If you find yourself needing to click a link from terminal in osx, then there is a way to open it without having to copy / paste it to your browser. hold cmd + double click on the url and it will open in your default browser!
🌐
Brett Terpstra
brettterpstra.com › 2014 › 08 › 06 › shell-tricks-the-os-x-open-command
Shell tricks: the OS X open command - BrettTerpstra.com
August 6, 2014 - You can also use it with application-specific urls, such as Dash’s dash: handler (I’ve detailed this before): ... These are the uses most people who use the command are familiar with. You can open an app without a document with just the -a or -b flags, too. I alias open -a to just o on my system, so I can just type o tweetbot and launch the app. I’ve also set up bash completion for this. A couple of lesser-known features are pretty handy. First, the -F switch opens the specified application “fresh,” meaning no “persistent” windows are restored.