Can I open a directory from command line?


I want to open a directory as a project from command line.

such as

$ /Applications/ ./ 


$ /Applications/ /path/to/new/directory 

But it fails.

Is there a way to do this?



Hi there,

I'm not a Mac user .. but as far as I know you should use "Tools | Create Command-line Launcher..." first -- it should create a "pstorm" script/launcher (whatever it's properly called) which you can use to launch your PhpStorm from terminal.

  • "pstorm ." -- this should open PhpStorm and open (or create if does not exist) project in current folder (that pstorm script should expand "." into full path and launch PhpStorm with full path as argument
  • "pstorm /full/path/to/some/dir" -- this should open PhpStorm and open (or create if does not exist) project in that specific folder

If it still fails -- please check "idea.log" file (Help | Show Log in...) for possible hints.


Thanks Andriy Bazanov!

That is the way I want to do!

$ git clone
$ pstorm .

Then I can open PHPStorm and make it a project.

Really Thanks!


Almost OK but I have a little problem.

I can open a directory when I closed PHPStorm.
But I cannot open a directory when I already opened PHPStorm project.

pstorm command does not open a new tab.

Any ideas?



What's the exact command you're entering while IDE is opened? 

There might be an issue with this: - for some users IDE won't open another project with a `pstorm` command while IDE is running.


Thank you Dmitry Tronin.

The command is

pstorm .

But it just focuses to

It might be the same issue you told me.
I give up to open a directory from command line.



My friends solve the problem!

$ open -a IntelliJ\ IDEA\ 15 ./


$ open -a PhpStorm ./




@Satoshi's version works for me.

The problem I found with `pstorm` is that `pstorm` would not open another directory if there are already opened project(s). :/



I aliased the open command it really helps me.

such as

 $ alias op='open -a PhpStorm'
$ git clone
$ op dotfiles




Sorry, but the suggested solution stopped working after upgrade to macOS Catalina. Before it was working fine. Any suggestions?



I'm using Catalina, and still use it all the time. However, I'm using Intellij now:

    $ alias op
    op='open -a IntelliJ\ IDEA'



Philip Z your suggestion did not work for me either.
Sorry, I should provide more context in my original question:
- I`m on macOS Cataline, version 10.15.5
- I`m using JetBrains Toolbox App, version 1.17.7018 (, but not a standalone installation
- PhpStorm version is 2020.1.2

I was trying to link `~/Library/Application\ Support/JetBrains/Toolbox/apps/PhpStorm/ch-0/201.7846.90/` into `/Applications/`. But that did not work.

Eventially, following command worked out for me:

/open -a ~/Library/Application\ Support/JetBrains/Toolbox/apps/PhpStorm/ch-0/201.7846.90/ ./

And that is cool, the only thing i`m considered about is the fact I would need to adjust this alias for further PhpStrom updates. Or is there a more flexible solution in my case?


@Dolgushev Serhey

What about built-in command line launcher? AFAIK the Toolbox App can generate them...

This ticket for example ( say it fixed some stuff... so it should work (sorry, I'm a Windows user that does not use Toolbox App)


Seems like it is indeed something similar to Andriy Bazanov should I submit a separate ticket for my case?


@Dolgushev Serhey

Accordingly to your 1.17.7018 version (which is newer than 1.17.6802 fix version from the ticket) it should be working. Maybe you just need to regenerate the launcher?..

If it would be me I would comment there in the ticket first providing my info and see what the devs will say. If somehow I get no response in few days or they tell "we need to investigate more" then I would do a new ticket.

Check the idea.log file anyway (Help | Show log in Finder...)



no such thing as sorry or should, any s k



In PhpStorm 2021.2.1 works for me likes Satoshi Kamigaki.

aliased command to open PhpStorm

alias phpstorm="open -a PhpStorm"
$ cd ~/MyProject
$ phpstorm .

Please sign in to leave a comment.