Lance Pollard
Lance Pollard

Reputation: 79268

Bring focus back to terminal window that called command

Say I have a terminal command (such as a make target) that opens a browser window (on a mac):

open http://localhost:3000/

By default, that open opens a browser window and now we're focused on the browser window. Is there a way instead to keep the focus on the current terminal window? (or bring the focus back to the terminal window somehow)

Upvotes: 2

Views: 772

Answers (1)

chepner
chepner

Reputation: 531205

You are looking for the -g option to open (although I don't know what mnemonic g is supposed to represent):

-g Do not bring the application to the foreground.

So you can simply use

open -g http://localhost:3000/

Upvotes: 3

Related Questions