How to run WebStorm, or any app, with terminal on MacOS
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
- MacOS
- Basic terminal knowledge
How to set it up
Reminder: You need admin rights to evoke sudo
- Create a new file
webstormin/usr/local/bin/
sudo touch /usr/local/bin/webstorm
- Open this file with your favorite editor, in this case, vim
sudo vim /usr/local/bin/webstorm
- Paste this to the opened file
#!/bin/sh
open -na "WebStorm.app" --args "$@"
- Make this file executable with chmod
sudo chmod +x /usr/local/bin/webstorm
- 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:
- Edit step 1 by creating or renaming the file name in
/usr/local/binfromwebstormtopycharmor any name you prefer to type in terminal in order to execute. - Edit step 3 by renaming Application file from
WebStorm.apptoPyCharm.app,"IntelliJ IDEA.app"to open your application of choice in terminal. Ensure the .app name match the filename in your /Applications/ directory.