In some flavors of Unix, you feel as if you've been cast into an alternate universe when you open a terminal window and work on the command line. But with OS X and its Darwin core, there's often an elegant integration between the two. In this how-to I'll show you how to launch an OS X app from the command line with the open command.

  1. Mac Run App With Arguments
  2. Mac Start App With Parameters
  3. Mac Start App With Arguments Iphone

Q&A for Work. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. To cause this executable to be run with specific arguments, simply rename the existing executable to something else (I've used something like appname-bin) and replace it with a shell script that.

[Note: A little bit of prior UNIX experience will be helpful here.]

Mac start app with arguments iphone

First off, I will admit this technique is fairly geeky. In my [Mac] OS X career, I've only used this trick a handful of times. However, it's so darn cool and charming that one just aches to use it at any opportunity.

With

Actually, upon reflection, there are some useful scenarios for this technique.

  1. The Finder acts up, a terminal window is already open, and you'd like to be able to launch a GUI app that might help you diagnose the problem.
  2. You're a UNIX professional, live and breathe the command line, but you'd rather use a GUI text editor for coding instead of the raw and ugly vi or Emacs editors.
  3. You're writing, say, a Perl or Python script, for another user and, at some point in the script, you'd like to launch a GUI app that carries the workflow forward.
  4. You want to quickly run a utility with admin privileges without the restriction of the account you're logged into. See, for example, 'How to Find & Recover Missing Hard Drive Space.' In that case, you must bypass the open command and drill into the Package Contents to run the app with sudo and admin privileges. But I've digressed.

The Man Page

The terminal app is in the Utilities folder—which is found the Applications folder. Launch it now. The BSD UNIX command we'll be using is open. Below is the manual page ('man' for short), shown by typing:

I've printed most of the man page for the open command here for your perusal, but I'm not going to explore every argument. And feel free to jump right to the examples below to whet your appetite.

For this limited how-to, one interesting way to use the open command in this context is to use the [-a] option. Some other useful variations and arguments are in the examples below.

Typical Examples

Here are some short and sweet examples of the open command with the -a, -e, and -t arguments. They're easy to try. [If you don't have BBEdit installed, use any other favorite a text editor in /Applications.]

Open Doors

These are just a few of the cool things you can do on the command line with the open command. To keep things simple, I haven't delved into creating a search path or other Unix tricks like aliases. All that's been left for you to explore on your own.

I think this is one of the neatest tricks in OS X.

__________________

Arguments

Launch button via Shutterstock.

-->

This article applies to: ✔️ .NET Core 2.x SDK and later versions

Name

dotnet run - Runs source code without any explicit compile or launch commands.

Synopsis

Description

The dotnet run command provides a convenient option to run your application from the source code with one command. It's useful for fast iterative development from the command line. The command depends on the dotnet build command to build the code. Any requirements for the build, such as that the project must be restored first, apply to dotnet run as well.

Output files are written into the default location, which is bin/<configuration>/<target>. For example if you have a netcoreapp2.1 application and you run dotnet run, the output is placed in bin/Debug/netcoreapp2.1. Files are overwritten as needed. Temporary files are placed in the obj directory.

If the project specifies multiple frameworks, executing dotnet run results in an error unless the -f|--framework <FRAMEWORK> option is used to specify the framework.

The dotnet run command is used in the context of projects, not built assemblies. If you're trying to run a framework-dependent application DLL instead, you must use dotnet without a command. For example, to run myapp.dll, use:

For more information on the dotnet driver, see the .NET Core Command Line Tools (CLI) topic.

To run the application, the dotnet run command resolves the dependencies of the application that are outside of the shared runtime from the NuGet cache. Because it uses cached dependencies, it's not recommended to use dotnet run to run applications in production. Instead, create a deployment using the dotnet publish command and deploy the published output.

Implicit restore

You don't have to run dotnet restore because it's run implicitly by all commands that require a restore to occur, such as dotnet new, dotnet build, dotnet run, dotnet test, dotnet publish, and dotnet pack. To disable implicit restore, use the --no-restore option.

The dotnet restore command is still useful in certain scenarios where explicitly restoring makes sense, such as continuous integration builds in Azure DevOps Services or in build systems that need to explicitly control when the restore occurs.

For information about how to manage NuGet feeds, see the dotnet restore documentation.

This command supports the dotnet restore options when passed in the long form (for example, --source). Short form options, such as -s, are not supported.

Mac Run App With Arguments

Options

  • --

    Delimits arguments to dotnet run from arguments for the application being run. All arguments after this delimiter are passed to the application run.

  • -c|--configuration <CONFIGURATION>

    Defines the build configuration. The default for most projects is Debug, but you can override the build configuration settings in your project.

  • -f|--framework <FRAMEWORK>

    Builds and runs the app using the specified framework. The framework must be specified in the project file.

  • --force

    Forces all dependencies to be resolved even if the last restore was successful. Specifying this flag is the same as deleting the project.assets.json file.

  • -h|--help

    Prints out a short help for the command.

  • --interactive

    Allows the command to stop and wait for user input or action (for example, to complete authentication). Available since .NET Core 3.0 SDK.

  • --launch-profile <NAME>

    The name of the launch profile (if any) to use when launching the application. Launch profiles are defined in the launchSettings.json file and are typically called Development, Staging, and Production. For more information, see Working with multiple environments.

  • --no-build

    Doesn't build the project before running. It also implicit sets the --no-restore flag.

  • --no-dependencies

    When restoring a project with project-to-project (P2P) references, restores the root project and not the references.

  • --no-launch-profile

    Doesn't try to use launchSettings.json to configure the application.

  • --no-restore

    Doesn't execute an implicit restore when running the command.

  • -p|--project <PATH>

    Specifies the path of the project file to run (folder name or full path). If not specified, it defaults to the current directory.

  • -r|--runtime <RUNTIME_IDENTIFIER>

    Specifies the target runtime to restore packages for. For a list of Runtime Identifiers (RIDs), see the RID catalog. -r short option available since .NET Core 3.0 SDK.

  • -v|--verbosity <LEVEL>

    Sets the verbosity level of the command. Allowed values are q[uiet], m[inimal], n[ormal], d[etailed], and diag[nostic]. The default value is m. Available since .NET Core 2.1 SDK.

Mac Start App With Parameters

Examples

Mac Start App With Arguments Iphone

  • Run the project in the current directory:

  • Run the specified project:

  • Run the project in the current directory (the --help argument in this example is passed to the application, since the blank -- option is used):

  • Restore dependencies and tools for the project in the current directory only showing minimal output and then run the project:(.NET Core SDK 2.0 and later versions):