user1311390
user1311390

Reputation:

Firefox openURL : OSX Command Line

Context

I want to open a Firefox browser from the command line and have it go to youtube.com

I have tried: open /Applications/Firefox.app --args -remote "openURL(www.youtube.com, new-tab)"

It successfully opens a Firefox, but does not navigate to youtube.com

Question:

How do I fix this?

Upvotes: 28

Views: 19661

Answers (5)

mbokil
mbokil

Reputation: 3330

You can open Firefox to a specific url and pass params if you want. Note: kiosk mode is an example only supported in Firefox 71 beta.

open -a /Applications/Firefox.app "https://stackoverflow.com" --args --kiosk

Upvotes: 1

david
david

Reputation: 131

Maybe you can append two aliases, edit ~/.bash_profile, append code below:

open_by_browser(){ open -a $1 $2}
alias firefox='open_by_browser firefox'
alias chrome='open_by_browser "Google Chrome"'

then you can open html file by Firefox

firefox xxx.html

or by Chrome

chrome xxx.html

Upvotes: 9

user377628
user377628

Reputation:

The others' answers work by the way, but another way you can do it is:

/Applications/Firefox.app/Contents/MacOS/firefox "youtube.com"

Upvotes: 3

Tim Pote
Tim Pote

Reputation: 28029

If firefox is your default browser you can simply use: open 'http://www.youtube.com'

Upvotes: 17

LaC
LaC

Reputation: 12824

open -a Firefox 'http://www.youtube.com/'

Upvotes: 77

Related Questions