Thread Subject: how to set environment variable when running Matlab from Finder on Mac?

Subject: how to set environment variable when running Matlab from Finder on Mac?

From: Michael Levin

Date: 13 Sep, 2011 07:20:32

Message: 1 of 3

I start Matlab from the Finder on a Mac, not from a terminal shell. I need to have an environment variable set because of a bug that makes my R2007 Matlab not work with the new Java. What I need is

setenv DYLD_LIBRARY_PATH "/System/Library/Frameworks/JavaVM.framework/Libraries"

   after which it works fine, if I start it from the Terminal. But I don't want to have to go to the terminal to start it - I want to start it from an icon in the Finder. Where can I place this setenv so that it gets executed as the Matlab starts up?

thanks,

Mike

Subject: how to set environment variable when running Matlab from Finder on Mac?

From: Ken Prager

Date: 14 Sep, 2011 11:52:59

Message: 2 of 3

In article <j4n080$nha$1@newscl01ah.mathworks.com>,
 "Michael Levin" <mlevin@forsyth.org> wrote:

> I start Matlab from the Finder on a Mac, not from a terminal shell. I need to
> have an environment variable set because of a bug that makes my R2007 Matlab
> not work with the new Java. What I need is
>
> setenv DYLD_LIBRARY_PATH
> "/System/Library/Frameworks/JavaVM.framework/Libraries"
>
> after which it works fine, if I start it from the Terminal. But I don't
> want to have to go to the terminal to start it - I want to start it from
> an icon in the Finder. Where can I place this setenv so that it gets
> executed as the Matlab starts up?


One solution is to use Automator to both run a shell script and then
also start Matlab. For more info, do a search on:

   automator run shell script

Cheers,

Ken Prager

Subject: how to set environment variable when running Matlab from Finder

From: Brian Arnold

Date: 19 Sep, 2011 15:21:06

Message: 3 of 3

Hi Mike,

To resolve this incompatibility with the recent Java update, please edit
the hidden file, /Applications/MATLAB_R2007a/bin/.matlabrc.sh.

That file is used by both the Finder (double-click) and by the matlab
shell script (command line), and will keep you from changing shell
environment files that may affect other applications, or other, more
hokey solutions.

More detailed instructions can be found here and here:

<
http://www.mathworks.com/support/solutions/en/data/1-F37IJB/?solution=1-F37IJB
 >

<
http://www.mathworks.com/matlabcentral/answers/11086-matlab-closing-automatically-when-plotting-data-or-opening-an-existing-saved-figure
 >

- Brian


On 9/13/11 3:20 AM, Michael Levin wrote:
> I start Matlab from the Finder on a Mac, not from a terminal shell. I
> need to have an environment variable set because of a bug that makes my
> R2007 Matlab not work with the new Java. What I need is
>
> setenv DYLD_LIBRARY_PATH
> "/System/Library/Frameworks/JavaVM.framework/Libraries"
>
> after which it works fine, if I start it from the Terminal. But I don't
> want to have to go to the terminal to start it - I want to start it from
> an icon in the Finder. Where can I place this setenv so that it gets
> executed as the Matlab starts up?
>
> thanks,
>
> Mike

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com