MacOS – OS X terminal “open” command and keeping focus on the command line

command linemacosterminal

I appreciate the "open" terminal command to launch OS X apps. When invoking the open command for any purpose, it is overwhelmingly likely that I will have at least one other command I would like to type into the terminal before tending to the application I have just summoned.

How do I keep focus on the terminal when using the open command?

Best Answer

Use the -g flag.

From the man page:

-g Do not bring the application to the foreground.

Example: To open the folder at your current path, behind the current Terminal window:

open . -g

As a side note, it is often better to manually peruse the documentation for new commands, as the verbiage may be different from what you expect:

i.e. "Do not bring the application to the foreground." vs. "Maintain terminal window focus."