Open current folder in PhpStorm from command line

Posted on 2. September 2022

Do you work a lot with the shell and PhpStorm on macOS? You can easily open the current folder in PhpStorm or in any other IntelliJ product with a shortcut direct out of the console by adding an alias!

The shortcut

# open current folder in PhpStorm p .

Setup

Just run the following command in the console depending on the shell you are using:

Zsh:

echo $'alias p=\'open -na "PhpStorm.app" --args "$@"\'' >> ~/.zshrc && source ~/.zshrc

Bash:

echo $'alias p=\'open -na "PhpStorm.app" --args "$@"\'' >> ~/.bashrc && source ~/.bashrc

Now you can open the current folder in PhpStorm out of the folder in the console by just entering p .

Of course, you can also change the shortcut to any other available string.

Thanks Renato for the idea.

Made with ♥️ and Gatsby © 2024