Opening applications from the command line in macOS

Summary:

Open an app from the commandline:

open macosopen.md

Details:

Using a specific application

Open a specific application with the -a option.

In the example below the . specifies the current working directory should be opened. In Visual Studio Code, this is the equilivant to opening a workspace:

[email protected]:~/www $ open -a 'Visual Studio Code' .
[email protected]:~/www

vscode open

Open multiple instances

The same application can be opened in a new instance by using the -n option.

By default applications such as wireshark do not open multiple instances, instead they close the current file and open a new one. The -n creates a new application instance per open.

[email protected]:~ $ ls -al *pcap
-rw-r--r--  1 root      staff    121693 Apr 13 10:57 fmd.pcap
-rw-r--r--  1 jemurray  staff      1668 May 10 17:33 icmp-mtu.pcap
[email protected]:~ $

[email protected]:~ $ open -n icmp-mtu.pcap
[email protected]:~ $ open -n fmd.pcap
[email protected]:~ $

open multiapp


comments powered by Disqus