external tools' environment


Me OS: OS X 10.6.6

I need to be running several external command line 3rd party tools, which heavily rely on other programs. Eg.: packages from NPM - Node Package Manager
Those rely on node being installed and available via the PATH environment.
Now damn me if I haven't tried setting up PATH for both login and non-login shells. I've tested it, and it worked in both of them.
Yet if the called node package references the node environment like:

#!/usr/bin/env node

It seems not to recognize what 'node' is.
I need to know, how does the WebIDE run those commands? Is there a way to include some IDE-only invocation file, like .basrc?


Hi!  Could you explain your problem once more? You add "node" as external tool, specifying command "node", and it is not recognized, allthough this command works is all shells, do you? What error exactly do you get?


Sorry - double post. Can't find a way to delete a post. ;)


I assuming you talking node.js?

and you get "see it" in PHPStorm?

Oh hold on.. I got it now. You need to  access the package manager from within PHpStorm?

Man, node.js is moving FAST. I didn't even know it had a package manager, ;) I'm gonna install it.

Another edit:
Also someone chime in, does PHpStorm understand a #! (shebang) line?


Well, yes, i get "see it" with these settings:
Node external tool settings.png
Did you restart IDE after setting $PATH$? Not sure about other OS'es, but on Windows threads don't see system variables changes made after thread's start.


Ok, I'll try to be as precise as possible:

  • I need to run JSHint from time to time on my files, and running it inside the IDE would be perfect (not to mention running it on every file save)
  • JSHint is a package for node.js, installed via NPM
  • JSHint has it's script which launches it, with the shebang line
    #!/usr/bin/env node 

    Screen shot 2011-05-26 at 12.00.51.png
  • the said script is in the directory ~/local/node/bin
  • that directory also includes the node program (as an Unix executable file), which the above shebang instruction refers to
  • the PATH to node.js' binaries is included in ~/.bashrc, like this:
    export PATH=$HOME/local/node/bin:$PATH
  • since OS X 10.6 rather uses ~/.profile instead of bashrc, I call it from .profile like this:
    . ~/.bashrc
  • in terminal, I get the following thanks to such config:
    Screen shot 2011-05-26 at 12.21.08.pngScreen shot 2011-05-26 at 11.59.05.png
  • in PHPStorm, I have the external tool configured like this:
    Screen shot 2011-05-26 at 11.53.09.png
  • the result of running that external tool in the IDE:
    Screen shot 2011-05-26 at 12.02.08.png

The conclusion for me from above facts are:

  • the shell which PHPStorm starts has the PATH variable containing the path to node.js' binaries (because it executes the jshint shell script) (EDIT: not really; in my config I have an absolute path to the tool)
  • for some reason, it loses that PATH when running the shebang line (EDIT: not really; it never had the PATH set as expected, jshint was running only because it was referenced by an absolute path). I actually verified this by modifying the jshint shell script and it's shebang line, so that instead of node I'd have the full path to the node executable - and it worked like I expected it to. Yet I messed with code of a 3rd party tool, which I obviously don't want to and won't be doing.

Another experiment I made is just trying to run the jshint command in the IDE. The result had me buffled:
Screen shot 2011-05-26 at 12.06.17.png
EDIT: well, not anymore - the IDE's shell just doesn't have the PATHs I need to launch the tools and which they rely on; if everything depended on is declared as absolute path, it works; once it starts relying on environment variables, it breaks.

And yes, I have restarted the IDE after each try to change something in my environments configuration.

Message was edited by: Marek Stasikowski


I guess the only workaround is setting external tool this way: set program node, or with full path - both configurations work for me, and provide parameters $full_path_to_jshint$ $FilePath$ .


Yeah, this seems like a workaround for now. But shouldn't I report this as a bug/feature request?


Sure you are welcome to post feature request here.


right now only a workaround available, as described by Elena; feature request created at http://youtrack.jetbrains.net/issue/WI-6461


What do you mean by "understand"? I've just made a test, script TestVariables.sh
echo $PATH

was run with Command Line Tool Support with .\TestVariables.sh command. I got string /bin/csh  /home/leneshka/TestProject/testVariables.sh in ps output instead of  usual /bin/sh /home/leneshka/TestProject/testVariables.sh


Bizzarre it be, but I got it working by accident. I don't know how, but I stumbled upon some stack overflow topic, and one person adviced to change the contents of


And it worked! PHPStorm properly executes all the programs I installed with NPM.

More info here: http://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

Great, Marek! I'm currently writing a topic about setting and testing cli tools in IDEs. environment.plist will be there as tested and recommended place for Mac.


Please sign in to leave a comment.