2

I would like to launch "Network diagnostics" from the command line.

1
3

To open a standard macOS application bundle, e.g. Network Diagnostics.app, via the command line, in e.g. Terminal, you can use the open command with the -a option, e.g.:

open -a Network\ Diagnostics

Note that you do not necessarily need to use the .app extension or its pathname, /System/Library/CoreServices/Network Diagnostics.app, although you can if you so choose or the situation warrants it.

Note: In the use case there is no need or advantage to using the fully qualified pathname of the binary executable:

/System/Library/CoreServices/Network\ Diagnostics.app/Contents/MacOS/Network\ Diagnostics

Aside from the fact it's not necessary because the open -a command is there for that, using just the fully qualified pathname of the binary executable from the command line forces Terminal to stay open and that window is unusable until finished and Terminal cannot be closed without also terminating the binary executable of Network Diagnostics in the case.

Also note that even using an & after the fully qualified pathname, while it will return the command prompt, Terminal still cannot be closed without also terminating e.g. Network Diagnostics.

This is why using the open command with the -a option is the way to go when wanting to open a standard macOS application bundle from the command line.

6

High Sierra and newer OS have moved this to the Applications folder in CoreServices. On new OS - you can use this command.

open /System/Library/CoreServices/Applications/Network\ Utility.app/

If you need to script this for all OS - you'll need to check the version and check if Network Utility is in CoreServices or CoreServices/Applications folder/directory.

Most cases your launch services database is correct and can find the app - be sure you escape / quote the space when calling open -a

open -a "Network Utility"
open -a Network\ Utility
open -a Wireless\ Diagnostics

Same thing if you actually meant Wireless Diagnostics instead of Network Utility since there isn't a Network Diagnostics that ships with macOS.

0

If this is required for wireless network, you can do it easy like this: hold the Alt/Option key while clicking on the Wireless icon in the menubar, then select "Open wireless diagnostics".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .