4

Does anyone know how to open a new Firefox window from the command line while Firefox is already running? I can't find any solutions currently out there that work for me.

I've looked at the MDN web docs Command Line Options but everything I have tried there throws the "A copy of Firefox is already open. Only one copy of Firefox can be open at a time." error.

I use multiple Firefox Developer Edition windows across multiple spaces. I'd like to be able to swipe to a fresh space, type this command, and see a new window open in that space. A .bash_profile alias would be ideal.

Running macOS High Sierra 10.13.2 and Firefox Developer Edition 58.0b11 (64-bit).

6
  • I've been trying to work at this using AppleScript; unfortunately, it lacks functions needed to properly control spaces, and controlling them–with or without GUI scripting, which I try not to use since it's inelegant and breaks–is really hard. So far all I've got is something that opens a new window regardless spaces. I'll let you know if I find a solution, but I've been searching for a while with no success.
    – JMY1000
    Commented Dec 19, 2017 at 4:31
  • 1
    The crux of your question is to be able to open a new Firefox window from the command line in a different Space then its current running in and have that new window in the Space the Terminal is in that the command was run from. FWIW This is not easily doable (if at all) with Firefox, however, if you're willing to do it with Safari or Google Chrome, it's easily doable. It would not have to be done from the command line unless that's what you really want, because it can be an AppleScript app placed in the Dock and when clicked, will open a new Safari or GC window in whatever Space it's click in. Commented Dec 19, 2017 at 4:38
  • @JMY1000 what do you have working "that opens a new window regardless spaces"?
    – loum1n0us
    Commented Dec 19, 2017 at 19:04
  • 2
    @costellofax osascript -e 'tell application "Firefox" to activate' -e 'tell application "System Events" to keystroke "n" using command down'
    – JMY1000
    Commented Dec 19, 2017 at 21:17
  • @JMY1000 it looks like that should work but I still get the "A copy of Firefox is already open. Only one copy of Firefox can be open at a time." error when I run that command. Any idea around that?
    – loum1n0us
    Commented Dec 20, 2017 at 21:16

0

You must log in to answer this question.

Browse other questions tagged .