Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch PhpStorm with the command line using zsh

I'm looking to launch PhpStorm via the command line using zsh + oh-my-zsh.

pstorm .

I have read up on the topic and have seen countless suggestions pointing to "Create command-line launcher" and have messed with it extensively. I have also messed with the Application Settings > Shell Path by setting it to /bin/zsh, usr/bin/zsh, etc.

I always end up with:

zsh: command not found: pstorm

One thing I have noticed is when setting the Shell Path to /bin/zsh specifically, the text is greyed out in the field, as if to indicate it's invalid?

I have been regularly restarting iTerm to enable any new changes that may have been made to .zshrc.

Anyone out there done this successfully? Any ideas?

like image 755
Dustwise Avatar asked Aug 31 '25 17:08

Dustwise


2 Answers

The Tools menu of PhpStorm contains a command named Create command-line launcher. It asks you where to create the launcher (full path + file name) and on Unix-like systems it defaults to /usr/local/bin/pstorm.

Also, on Unix-like systems, /usr/local/bin usually is on the path. You can run echo $PATH in the terminal to find out if this is the case or not. If it's not there you can easily add it by adding the line:

PATH=/usr/local/bin:$PATH

in your .zshrc.

You can also use a different path for the command line launcher (in the bin subdirectory of your home directory, for example, or in other directory that already is in $PATH).


Shell path under the Tools -> Terminal page of the program settings is a different thing (and it doesn't help you launch PhpStorm from the shell; it is the other way around). It contains the path of the shell to launch (by PhpStorm) in its Terminal window (menu -> View -> Tool Windows -> Terminal).

like image 200
axiac Avatar answered Sep 02 '25 11:09

axiac


Latest standalone version doesn't come with pstorm shell script. We can create one at /usr/local/bin/pstorm.

#!/bin/sh

open -na "PhpStorm.app" --args "$@"

Give permission to execute pstorm.

chmod 0755 /usr/local/bin/pstorm

Reference: https://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html#standalone

If you are using Toolbox App, it can generate scripts for you.

  1. Open the Toolbox App and click The screw nut icon in the top right corner.
  2. In the Toolbox App Settings, enable Generate shell scripts.
  3. If necessary, change the shell scripts location.

Reference: https://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html#standalone

like image 26
Jigar Avatar answered Sep 02 '25 13:09

Jigar