Open PhpStorm from Terminal/Command line

Open a file/project in PhpStorm using the command line

Panjeh
2 min readJan 11, 2021

--

Solution 1:

For opening your current working directory in PhpStorm

You need first open Phpstrom and then go to Tools menu and find the

Create Command-line launcher
Tools -> Create command line launcher

Then it will open a window which is for “Create Launcher Script”

It says specify the name of the script you want to use in the terminal. By default it choose “pstorm” and we can change it, but it’s ok for me.

and that’s it!

After this we can open any file or project from terminal. To do this, Navigate to the project/folder you want to open.

We need to use what is written after “/usr/local/bin/ “ that is pstorm.

pstorm filename

or

pstrom projectname

or go inside the project and just type

pstorm

Solution 2:

Open the .zshrc file or bash file and put this alias:

alias pstorm='open -a /Applications/PhpStorm.app "`pwd`"'

or

alias pstrom="open -a 'phpstorm.app'"

source the bash file

source .zshrc

and then use pstorm like solution 1

Navigate to the inside of the desired directory and do

pstorm .

It will open the whole current directory

Solution 3:

Type in terminal this:

open -a 'phpstorm.app' file-or-folder

See more here:

https://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.htmlhttps://www.jetbrains.com/help/phpstorm/working-with-the-ide-features-from-command-line.html#standalonehttps://www.jetbrains.com/help/phpstorm/opening-files-from-command-line.html

--

--