[kepler-users] Mac OS, Matlab, and library paths

Joe Futrelle jfutrelle at whoi.edu
Wed Jun 29 09:28:43 PDT 2011


Further results. My advice upthread "use launchctl to set [PATH]" is not correct.

Putting Matlab on your path so that Kepler can invoke it turns out to be a different process depending on whether you are running Kepler from a shell prompt, or whether you're double-clicking the application icon.

As of Snow Leopard, it appears that the only way to set the PATH variable seen by GUI applications when they are launched from the Finder/Dock is using ~/.MacOSX/environment.plist.

However this approach is somewhat problematic in that in environment.plist variable references (i.e., $PATH) are not expanded, so there is no non-kludgy way I've found to *append* the Matlab executable's path to the PATH seen by GUI applications, using environment.plist.


The PATH approach that does work is using ordinary shell methods to append the Matlab bin directory to the path, and then invoking Kepler from that shell, like so:

$ launchctl getenv DYLD_LIBRARY_PATH
/Applications/MATLAB_R2011a.app/bin/maci64
$ export PATH=$PATH:/Applications/MATLAB_R2011a.app/bin
$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/Applications/MATLAB_R2011a.app/bin
$ open /Applications/Kepler-2.2/Kepler.app/

Can anyone advise how I might be able to get this working for launching Kepler from Finder/Dock? Obviously I can just stick with the shell approach, but I'd really like to be able to launch Kepler from the Dock.

On Jun 28, 2011, at 3:48 PM, Joe Futrelle wrote:

> OK, this thread resolved all of my issues. Thanks a lot guys! :)
> 
> To summarize:
> 
> DYLD_LIBRARY_PATH must include the Matlab libraries. Setting them with launchctl works, but don't expect to see them as shell environment variables unless you export them to the shell.
> 
> The Matlab executable (from its app package's bin directory) must be in your path. (Again, use launchctl to set).
> 
> I get different results when I use "open" from the command line to launch Kepler (works!) and when I double-click Kepler's app icon (doesn't), but I hypothesize that if I put both the DYLD_LIBRARY_PATH and PATH settings in /etc/launchd.conf and reboot, that it'll work. Unconfirmed as of yet.
> 
> Hopefully the above account is accurate and not confused ...
> 
> On Jun 28, 2011, at 3:20 PM, Daniel Crawl wrote:
> 
>> 
>> The matlab binary must be in your $PATH.
>> 
>> --dan
>> 
>> On 6/28/11 12:12 PM, Joe Futrelle wrote:
>>> This works.
>>> 
>>> And it gets me past the stack trace I was getting before! :)
>>> 
>>> Here's the transcript. I combined advice from two posts upthread.
>>> 
>>> bash-3.2# DYLD_LIBRARY_PATH=/Applications/MATLAB_R2011a.app/bin/maci64/ env | grep DYLD
>>> DYLD_LIBRARY_PATH=/Applications/MATLAB_R2011a.app/bin/maci64/
>>> bash-3.2# open /Applications/Kepler-2.2/Kepler.app
>>> 
>>> Now I'm getting a different stacktrace. I have a properly-licensed Matlab instance running and csh is @ /bin/csh.
>>> 
>>> ptolemy.kernel.util.IllegalActionException: matlabEngine.open(null) : can't find Matlab engine. Try starting Matlab by hand as an application to verify that Matlab is set up properly and the license is correct. Under Windows, try running "matlab /regserver", the Matlab C API communicates with Matlab via COM, and apparently the COM interface is not automatically registered when Matlab is installed. Under Linux and other types of UNIX, csh must be installed in /bin/csh.
>>> 	at ptolemy.matlab.Engine.open(Engine.java:280)
>>> 	at ptolemy.matlab.Engine.open(Engine.java:232)
>>> 	at ptolemy.matlab.Expression.preinitialize(Expression.java:303)
>>> 	at ptolemy.actor.Director.preinitialize(Director.java:1010)
>>> 	at ptolemy.actor.Director.preinitialize(Director.java:991)
>>> 	at ptolemy.domains.ct.kernel.CTDirector.preinitialize(CTDirector.java:748)
>>> 	at ptolemy.domains.ct.kernel.CTMultiSolverDirector.preinitialize(CTMultiSolverDirector.java:637)
>>> 	at ptolemy.actor.CompositeActor.preinitialize(CompositeActor.java:1735)
>>> 	at ptolemy.actor.Manager.preinitializeAndResolveTypes(Manager.java:983)
>>> 	at ptolemy.actor.Manager.initialize(Manager.java:643)
>>> 	at ptolemy.actor.Manager.execute(Manager.java:340)
>>> 	at ptolemy.actor.Manager.run(Manager.java:1164)
>>> 	at ptolemy.actor.Manager$3.run(Manager.java:1217)
>>> 
>>> 
>>> On Jun 28, 2011, at 3:02 PM, Sean Riddle wrote:
>>> 
>>>> I can't get launchd.conf to set DYLD_LIBRARY_PATH, but for some reason
>>>> it doesn't set anything else either. But DYLD_LIBRARY_PATH is
>>>> settable, at least in some ways:
>>>> 
>>>> dhcp33-gc5:~ sean$ DYLD_LIBRARY_PATH=hello env | grep "DYLD_LIBRARY_PATH"
>>>> DYLD_LIBRARY_PATH=hello
>>>> 
>>>> I would recommend trying the support including in the build system for
>>>> setting environment variables. Create a file
>>>> kepler/module-info/environment.txt and specify the value there. You
>>>> can look at r/module-info/environment.txt for an example. Note that as
>>>> in the example, you can (and possible must, I'm not sure) specify
>>>> separate values for all three of the platforms that Kepler supports.
>>>> 
>>>> - Sean
>>>> 
>>>> On Tue, Jun 28, 2011 at 11:27 AM, Joe Futrelle<jfutrelle at whoi.edu>  wrote:
>>>>> I tried that, didn't work.
>>>>> 
>>>>> Again, I have no problem setting system-wide environment variables in launchd.conf. If I set "foo" to "bar" then "foo" is set to "bar" in my environment. But if I set DYLD_LIBRARY_PATH to anything, it's like I didn't set it at all.
>>>>> 
>>>>> Exactly the same behavior with environment.plist. It seems to me like DYLD_LIBRARY_PATH is on some kind of blacklist.
>>>>> 
>>>>> On Jun 28, 2011, at 2:15 PM, Sean Riddle wrote:
>>>>> 
>>>>>> I always heard that if you wanted to set environment variables for GUI
>>>>>> applications in OS X, you needed to edit the environment.plist file. A
>>>>>> stackoverflow thread
>>>>>> (http://stackoverflow.com/questions/135688/setting-environment-variables-in-os-x)
>>>>>> says it can be set on a per-user basis at ~/.MacOSX/environment.plist.
>>>>>> However, that thread also says that launchd.conf also works for GUI
>>>>>> applications. Maybe try setting it in environment.plist to see if that
>>>>>> makes a difference.
>>>>>> 
>>>>>> - Sean
>>>>>> 
>>>>>> PS - Property List Editor in Utilities is what creates and edits .plist files.
>>>>>> 
>>>>>> On Tue, Jun 28, 2011 at 11:09 AM, Joe Futrelle<jfutrelle at whoi.edu>  wrote:
>>>>>>> Hi, I'm trying to run Matlab codes from Kepler in Mac OS (Snow Leopard). As an inexperienced user I'm simply firing up the prepackaged Mac OS distribution of Kepler and double-clicking on the app icon.
>>>>>>> 
>>>>>>> It's no problem constructing a workflow with a "Matlab expression" in it, but when I run I get a stacktrace about the Matlab libraries not being on the DYLD_LIBRARY_PATH.
>>>>>>> 
>>>>>>> I'm having no trouble finding those libraries manually; they're right where they should be in my Matlab install, and they're 64 bit, and everything seems in order.
>>>>>>> 
>>>>>>> Setting DYLD_LIBRARY_PATH doesn't seem possible in Mac OS; I can set environment variables in launchd.conf, but launchd appears to silently ignore DYLD_LIBRARY_PATH; maybe it's special-casing it for some reason.
>>>>>>> 
>>>>>>> I'm having trouble finding a previous post on this list, or a bug in Kepler's bugzilla database, or a documentation section or FAQ entry that explains how to solve this. It's clear that some people have had problems with this in the past, but I don't see a clear description of what I should be doing. Any and all advice welcome.
>>>>>>> 
>>>>>>> Mac OS version: 10.6.7
>>>>>>> Java version: 1.6.0_24 (Java HotSpot(TM) 64-Bit Server VM (build 19.1-b02-334, mixed mode))
>>>>>>> Kepler version: 2.2
>>>>>>> Matlab version: R2011a
>>>>>>> 
>>>>>>> --
>>>>>>> Joe Futrelle
>>>>>>> Woods Hole Oceanographic Institution
>>>>>>> jfutrelle at whoi.edu
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> Kepler-users mailing list
>>>>>>> Kepler-users at kepler-project.org
>>>>>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>>>>>> 
>>>>>> 
>>>>> 
>>>>> --
>>>>> Joe Futrelle
>>>>> Woods Hole Oceanographic Institution
>>>>> jfutrelle at whoi.edu
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>>> 
>>> --
>>> Joe Futrelle
>>> Woods Hole Oceanographic Institution
>>> jfutrelle at whoi.edu
>>> 
>>> 
>>> 
>>> 
>>> _______________________________________________
>>> Kepler-users mailing list
>>> Kepler-users at kepler-project.org
>>> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
>>> 
>> 
> 
> --
> Joe Futrelle
> Woods Hole Oceanographic Institution
> jfutrelle at whoi.edu
> 
> 
> 
> 
> _______________________________________________
> Kepler-users mailing list
> Kepler-users at kepler-project.org
> http://lists.nceas.ucsb.edu/kepler/mailman/listinfo/kepler-users
> 

--
Joe Futrelle
Woods Hole Oceanographic Institution
jfutrelle at whoi.edu







More information about the Kepler-users mailing list