Mac Run App From Command Line With Arguments
Close Background Applications. This is great advice whether you are running Fortnite on. Starting in OS X 10.6.2, the open command can pass arguments to the application it opens by way of the -args flag. An AppleScript to use it looks like this: do shell script 'open -a /Applications/Firefox.app -args -P default -no-remote' That should.
- Recently I've been wanting a way to pass command-line arguments to GUI apps by default, in my case a -geometry parameter to Emacs.app to make it start up in something approximating full-screen mode. It turns out there's a very easy way to do this.
- In this Command Line Programs on macOS tutorial, you will write a command-line utilty named Panagram. Depending on the options passed in, it will detect if a given input is a palindrome or anagram. It can be started with predefined arguments, or run in interactive mode where the user is prompted to enter the required values.
- By default, the Toolbox App puts shell scripts in a directory from the system PATH environment variable, so you can run the name of the script as a command to launch WebStorm from any working directory. Command-line arguments. The launcher script accepts commands, options, and other arguments to modify its behavior.
Use PhpStorm features from the command line: open files and projects, view diffs, merge files, apply code style formatting, and inspect the source code.
For information about running command-line tools from inside PhpStorm, see Terminal.
Launcher for a standalone instance
The installation directory contains batch scripts and executables for launching PhpStorm, formatting the source code, and running inspections. To use them from the Command Prompt cmd.exe, add the location of the PhpStorm bin folder to the PATH
environment variable. For example, if you installed PhpStorm to C:Program FilesJetBrainsPhpStorm, you can use the following command:
This command changes the PATH
environment variable for the current shell only (the current instance of cmd.exe ). If you want to update it permanently for the current user, run setx
. To update it system-wide for all users, run setx /M
.
The installer can do this for you if you select Add launchers dir to the PATH on the Installation Options step of the setup wizard.
After you configure the PATH
variable, you can run the corresponding executable from any working directory in the Command Prompt: phpstorm64.exe
for 64-bit versions or phpstorm.exe
for 32-bit versions. Alternatively, you can use the batch script: phpstorm.bat
.
To run PhpStorm from the shell, use the open
command with the following options:
-a
: specify the application.--args
: specify additional arguments when passing more than just the file or directory to open.-n
: open a new instance of the application even if one is already running.
For example, you can run PhpStorm.app with the following command:
If PhpStorm is not in the default /Applications directory, specify the full path to it.
You can create a shell script with this command in a directory from your PATH
environment variable. For example, create the file /usr/local/bin/phpstorm with the following contents:
Make sure you have permissions to execute the script and since /usr/local/bin should be in the PATH
environment variable by default, you should be able to run phpstorm
from anywhere in the shell.
On Linux, the installation directory contains the launcher shell script phpstorm.sh under bin. For example, if you installed PhpStorm to /opt/phpstorm, you can run the script using the following command:
You can create a symbolic link to the launcher script in a directory from the PATH
environment variable. For example, if you installed PhpStorm to /opt/phpstorm and want to create a link named phpstorm in /usr/local/bin, run the following command:
Mac Run App From Command Line With Arguments Free
Since /usr/local/bin should be in the PATH
environment variable by default, you should be able to run the phpstorm
command from anywhere in the shell.
Shell scripts generated by the Toolbox App
If you are using the Toolbox App to install and manage JetBrains products, it can create shell scripts for launching your IDEs from the command line.
Generate shell scripts
Open the Toolbox App and click in the top right corner.
In the Toolbox App Settings, enable Generate shell scripts.
If necessary, change the shell scripts location.
If you have several versions of the same IDE, the Toolbox App generates a shell script for each version with a unique name. You can change the name of the shell script for an IDE instance in the settings for this specific instance.
Change the name of the shell script
Open the Toolbox App.
Click next to the relevant IDE instance and select Settings.
At the bottom, change the Shell script name field.
By default, the Toolbox App puts shell scripts in a directory from the system PATH
environment variable, so you can run the name of the script as a command to launch PhpStorm from any working directory.
Command-line arguments
The launcher script accepts commands, options, and other arguments to modify its behavior:
Argument | Description |
---|---|
No argument | Launch PhpStorm. |
Path to file or directory | Open the file or directory specified as the argument. For more information, see Open files from the command line. |
Commands | |
diff | Open the diff viewer to see differences between two specified files. For more information, see Compare files from the command line. |
merge | Open the Merge dialog to merge the specified files. For more information, see Merge files from the command line. |
format | Apply code style formatting to the specified files. For more information, see Format files from the command line. |
inspect | Perform code inspection on the specified project. For more information, see Run code inspections from the command line. |
Options | |
nosplash | Do not show the splash screen when loading PhpStorm. |
dontReopenProjects | Do not reopen projects and show the welcome screen. This can help if a project that was open crashes PhpStorm for some reason. |
disableNonBundledPlugins | Do not load manually installed plugins. This can help if a plugin that you installed crashes PhpStorm for some reason. You will be able to start the IDE and either disable or uninstall the problematic plugin. |
--wait | Wait for the files to be closed before returning to the command prompt. |
Platypus is a developer tool that creates native Mac applications from command line scripts such as shell scripts or Python, Perl, Ruby, Tcl, JavaScript and PHP programs. This is done by wrapping the script in a macOS application bundle along with an app binary that runs the script.
Platypus makes it easy to share scripts and programs with people who are unfamiliar with the command line interface. Native, user-friendly applications can be created with a few clicks. It is very easy to create installers, droplets, administrative applications, login items, status menu items, launchers and automations using Platypus.
Features
- Supports shell scripts, Python, Perl, Ruby, PHP, Swift, Expect, Tcl, AWK, JavaScript, AppleScript or any other user-specified interpreter
- Apps can display graphical feedback of script execution as progress bar, text window with script output, droplet, WebKit HTML rendering or status item menu
- Apps support receiving dragged and dropped files or text snippets, which are then passed to the script as arguments
- Apps can execute scripts with root privileges via the macOS Security Framework
- Apps can register as handlers for URI schemes and send user notifications
- Apps can be configured to run in the background (LSUIElement)
- Set own application icon or select from presets
- Set app's associated file types, identifier, version, author, etc.
- Graphical interface for bundling support files with the script
- Command line tool for automation and build process integration
- 'Profiles' can be used to save app configurations
- Built-in script editor, or linking with external editor of choice
- Extensive documentation and many built-in examples to help you get started
- Fast, responsive native app written in Objective-C/Cocoa
Mac Run App From Command Line With Arguments Windows 10
License
Platypus is free, open source software distributed under the terms of the three-clause BSD license and has been continually maintained and developed for a very long time (since 2003). It is written in Objective-C/Cocoa. The source code is available on GitHub.
If Platypus makes your life easier, please make a donation to support continued development.
Mac Run App From Command Line With Arguments Using
Download
The latest version is Platypus 5.3, released on November 25th, 2018. Platypus and Platypus-generated applications require macOS 10.8 or later, and are 64-bit Intel binaries. The main Platypus application is Apple Developer ID signed.
Platypus can also be installed via Homebrew (may not be latest version):
If you want to target 10.6 and/or 32-bit systems, version 4.9 continues to work just fine. If you want to target 10.4 and PowerPC, you can use version 4.4.
- man page (HTML)
- Appcast (XML)
Screenshots
Platypus lets you select one of several different user interfaces for your script.