How to configure IDEA 8.1.3 to read P4CONFIG on Mac OS X?

I've found an old Bug ( and an old discussion ( about this issue, but both were for previous IDEA versions, and neither helped me solve the problem at hand.

On Mac OS X, when IDEA is configured to "Use P4CONFIG or default connection" the Test Connection command fails with "Connection failed: Perforce client error: Connect to server failed; check $P4PORT.  TCP connect to perforce failed.  perforce: host unknown.  Attempting to do anything with perforce in a specific project fails with the same exception.

I've created a ~/.bash_profile that includes the following line:
export P4CONFIG=.p4config

My .p4config has the following in it (private information changed to XXX for this post):

I've tried copying the .p4config into ~, /, /Applications/IntelliJ IDEA, the .IML/.IPR directory and my perforce depot root (/depot).  IDEA never seemed to find the .p4config in any of those locations.

P4 itself works fine from the command line.

The p4.output isn't providing anything useful either:

Perforce client error:
        Connect to server failed; check $P4PORT.
        TCP connect to perforce failed.
        perforce: host unknown.



1 comment
Comment actions Permalink

I finally stumbled upon the answer to this over here:

In summary, GUI apps (such as IDEA) don't have access to environment variables defined in ~/.profile or ~/.bash_profile.  They do read properties from ~/.MacOSX/environment.plist, but not if you launch them from Spotlight.  If you launch GUI apps from Spotlight, you have to defined your environment in /etc/launchd.conf using the syntax 'setenv PROPERTY value'.


Please sign in to leave a comment.