WebStorm does not include the command-line execution and this is a hybrid guide to run WebStorm or any other apps in terminal on MacOS.

This guide will help you set up a simple bash script to run webstorm . in terminal to open WebStorm IDE in terminal’s current directory with 5 short steps.

Note: This guide does not only apply for WebStorm, you can do the same step for any other GUI apps — PyCharm, IntelliJ IDEA, or any other apps. This guide uses WebStorm as an example. Refer to the last section for more details.

Requirements

How to set it up

Reminder: You need admin rights to evoke sudo

  1. Create a new file webstorm in /usr/local/bin/
sudo touch /usr/local/bin/webstorm
  1. Open this file with your favorite editor, in this case, vim
sudo vim /usr/local/bin/webstorm
  1. Paste this to the opened file
#!/bin/sh

open -na "WebStorm.app" --args "$@"
  1. Make this file executable with chmod
sudo chmod +x /usr/local/bin/webstorm
  1. Finally, test by executing the following command inside terminal:
webstorm .

If WebStorm launched in current directory from terminal’s directory – congratulations, you successfully got it working! 🎉

Set up different apps

Use this post as an reference to launch different app in terminal, use the above instruction as a reference with the following modifications:

  1. Edit step 1 by creating or renaming the file name in /usr/local/bin from webstorm to pycharm or any name you prefer to type in terminal in order to execute.
  2. Edit step 3 by renaming Application file from WebStorm.app to PyCharm.app, "IntelliJ IDEA.app" to open your application of choice in terminal. Ensure the .app name match the filename in your /Applications/ directory.