Setting environment variables for external tools on Mac OS X
Oxygen general issues.
-
- Posts: 1
- Joined: Wed Jul 02, 2014 1:45 am
Setting environment variables for external tools on Mac OS X
I'm having problems getting an external tool, which works fine on Windows, to work on Mac OS X. The tool could not be simpler, setting the working directory to ${cfd}, and the command line to "p4 edit ${cfd}/${cfne}". In other words "p4 edit <full_path_to_file>".
This tool definition works fine on Windows, and works fine from my Terminal window on Mac OS X, but when I try to run it from within Oxygen on Mac OS X, I get the following error:
If I create an external tool to do a printenv, I get quite a difference between my environment in Terminal and in Oxygen. The Oxygen environment is quite sparse (limited PATH, minimal vars, etc.):
Searching on the forum turns up only a few tangentially related discussions, and nothing that contains a clear, current answer. The ideal answer would provide a way to replicate my standard environment within Oxygen. Alternatively, a way to use an e.g. .oxygen_profile file or something like that to set an Oxygen-specific environment would be cool. Least good would be something that forces me to modify the global system environment in order to get Oxygen to pick it up...though I would take it.
Help appreciated!
This tool definition works fine on Windows, and works fine from my Terminal window on Mac OS X, but when I try to run it from within Oxygen on Mac OS X, I get the following error:
The error basically means that the $P4PORT variable set in my .bashrc file (and included into .bash_profile) isn't being picked up.Started: p4 edit /Users/malderete/dev/malderete-ltm/doc/main/core/en/xmlsource/workbook/workbook_apex/apex_workbook.xml
Perforce client error:
Connect to server failed; check $P4PORT.
TCP connect to perforce:1666 failed.
nodename nor servname provided, or not known
Process ended with exit code: 1
If I create an external tool to do a printenv, I get quite a difference between my environment in Terminal and in Oxygen. The Oxygen environment is quite sparse (limited PATH, minimal vars, etc.):
So, the question is, how do I set critical environment variables, like PATH, a variety of Perforce variables, and (for other tools I plan to set up) build settings?Started: printenv
PATH=/usr/bin:/bin:/usr/sbin:/sbin
TMPDIR=/var/folders/w1/sz49980x6sl0h04wkxgv7419h77wj5/T/
SHELL=/bin/bash
HOME=/Users/malderete
USER=malderete
LOGNAME=malderete
SSH_AUTH_SOCK=/tmp/launch-tcJZ6V/Listeners
Apple_PubSub_Socket_Render=/tmp/launch-t27Xjr/Render
__CF_USER_TEXT_ENCODING=0x6073F225:0:0
__CHECKFIX1436934=1
com.apple.java.jvmTask=BundledApp
JAVA_LIBRARY_PATH=/Applications/oxygenAuthor/Oxygen XML Author.app/Contents/Resources/Java:/System/Library/PrivateFrameworks/JavaApplicationLauncher.framework/Resources
com.apple.java.jvmMode=client
Process ended with exit code: 0
Searching on the forum turns up only a few tangentially related discussions, and nothing that contains a clear, current answer. The ideal answer would provide a way to replicate my standard environment within Oxygen. Alternatively, a way to use an e.g. .oxygen_profile file or something like that to set an Oxygen-specific environment would be cool. Least good would be something that forces me to modify the global system environment in order to get Oxygen to pick it up...though I would take it.

Help appreciated!
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Setting environment variables for external tools on Mac
Hi,
The environment you set in .bashrc and .bash_profile is only for bash so it is not supposed to work in windowed applications, only in a bash terminal.
If you want to rely on these bash specific configuration files for external tools configured in Oxygen, use bash in login mode:
bash -l -c printenv
There are various articles on stack overflow that discuss setting environment variables on OS X for windowed apps:
Set environment variables on Mac OS X Lion
This also discusses Mavericks.
Alternatively, if you want to set an environment variable only for Oxygen, you can add it to Oxygen's Info.plist file (right click on the .app, pick Show Package Contents and navigate to Contents) as described here:
Setting environment variables in OS X for GUI applications
e.g.
Regards,
Adrian
The environment you set in .bashrc and .bash_profile is only for bash so it is not supposed to work in windowed applications, only in a bash terminal.
If you want to rely on these bash specific configuration files for external tools configured in Oxygen, use bash in login mode:
bash -l -c printenv
There are various articles on stack overflow that discuss setting environment variables on OS X for windowed apps:
Set environment variables on Mac OS X Lion
This also discusses Mavericks.
Alternatively, if you want to set an environment variable only for Oxygen, you can add it to Oxygen's Info.plist file (right click on the .app, pick Show Package Contents and navigate to Contents) as described here:
Setting environment variables in OS X for GUI applications
e.g.
Code: Select all
<key>LSEnvironment</key>
<dict>
<key>P4PORT</key>
<string>1234</string>
</dict>
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service