Open an app from the command line in macOS

To open an application from the command line in macOS, you can use the open command followed by the -a flag and the name of the application. F or example, to open Safari, you would use the following command:

open -a "Safari"

You can also open files or directories with the open command. For example, to open a specific PDF file in Preview, you would use:

open -a "Preview" /path/to/your/file.pdf

I find this handy when I’ve generated coverage reports and want to quickly view them in a browser.