MATLAB started as an app in OS X causes problems with "unix" function
Show older comments
I noticed that the function "unix" acts differently, mainly in regards to my PATH variable, depending on whether I start MATLAB from the application or from Terminal.
When I start from Terminal, I get the same $PATH that I would in that Terminal window:
>> unix('echo $PATH')
/usr/local/fsl/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Applications/Inkscape.app/Contents/Resources/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
When I start from the Application, it gets a very basic PATH from... somewhere:
>> unix('echo $PATH')
/usr/bin:/bin:/usr/sbin:/sbin
I can change my path, but it reverts the next time I use the unix function:
>> unix('source /Users/pcrutchl/.bash_profile; echo $PATH')
/usr/local/fsl/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/Applications/Inkscape.app/Contents/Resources/bin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
ans =
0
>> unix('echo $PATH')
/usr/bin:/bin:/usr/sbin:/sbin
ans =
0
(To be clear: changing the path manually every time, or even initially, isn't really a solution, just an exploration of the behavior. If I could put something in startup.m to fix it, that would be fine.)
Is this known behavior? Is there a good way to get the application MATLAB to behave like the MATLAB launched from command line?
Accepted Answer
More Answers (0)
Categories
Find more on Startup and Shutdown in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!