From: laredotornado on
Hi,

I'm using Mac 10.6.3. I thought the way to set global environment
variables was to edit my /etc/profile file. For example, I have this
in the file ...

=========Begin /etc/profile ==============
# System-wide .profile for sh(1)

if [ -x /usr/libexec/path_helper ]; then
eval `/usr/libexec/path_helper -s`
fi

if [ "${BASH-no}" != "no" ]; then
[ -r /etc/bashrc ] && . /etc/bashrc
fi

export JAVA_HOME=/Library/Java/Home
export CATALINA_HOME=/Library/Tomcat/Home
export PATH=/opt/local/bin:/opt/local/sbin:$PATH
export MANPATH=/opt/local/share/man:$MANPATH

~
=========End /etc/profile ====================


However, when I restart my system and go into my terminal, I'm not
able to echo the values for the variables I defined ...

-bash-3.2$ echo $JAVA_HOME

-bash-3.2$


What am I doing wrong? Thanks, - Dave
From: JF Mezei on
VAXman- @SendSpamHere.ORG wrote:

> Also, edit something at the beginnning of your .profile to demarcate it;
> like #### my .profile

i have
echo Executing my own .profile

and various echo commands in various files so I can track when something
is being executed. I haven't quite yet mastered what all the various
incantations mean (.profile .bashrc and all the various X files that
used to work as expected but got broken with Leopard's redo of how X is
started)
From: JF Mezei on
laredotornado(a)zipmail.com wrote:

> Also, why did you list, "/bin/bash -l -v"? Did you want me to define
> those environment variables in there? - Dave

bash -l -v shows what gets executed when you start a new bash instance.
If you added commands in /etc/profile, you shoudl see them being
executed as part of this. If you don't see them, it measn you added them
to the wrong file.

Also a /etc/profile isn't really a "system wide" definition, it is a
defition which is applied separately to bash processes. Aka: you cannot
change the value of a symbol and have that new value be known to all
processes.
From: Barry Margolin on
In article
<545ec116-c67d-4505-8fbe-0fb29c2127c2(a)i37g2000yqn.googlegroups.com>,
"laredotornado(a)zipmail.com" <laredotornado(a)gmail.com> wrote:

> Hi,
>
> I'm using Mac 10.6.3. I thought the way to set global environment
> variables was to edit my /etc/profile file. For example, I have this
> in the file ...
>
> =========Begin /etc/profile ==============
> # System-wide .profile for sh(1)
>
> if [ -x /usr/libexec/path_helper ]; then
> eval `/usr/libexec/path_helper -s`
> fi
>
> if [ "${BASH-no}" != "no" ]; then
> [ -r /etc/bashrc ] && . /etc/bashrc
> fi
>
> export JAVA_HOME=/Library/Java/Home
> export CATALINA_HOME=/Library/Tomcat/Home
> export PATH=/opt/local/bin:/opt/local/sbin:$PATH
> export MANPATH=/opt/local/share/man:$MANPATH
>
> ~
> =========End /etc/profile ====================
>
>
> However, when I restart my system and go into my terminal, I'm not
> able to echo the values for the variables I defined ...
>
> -bash-3.2$ echo $JAVA_HOME
>
> -bash-3.2$
>
>
> What am I doing wrong? Thanks, - Dave

/etc/profile and ~/.profile are only executed in login shells, not
ordinary shells.

In your Terminal preferences, in the Startup tab, is "Shells open with
Default login shell" selected?

--
Barry Margolin, barmar(a)alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
From: laredotornado on
On Apr 14, 7:16 pm, Barry Margolin <bar...(a)alum.mit.edu> wrote:
> In article
> <545ec116-c67d-4505-8fbe-0fb29c212...(a)i37g2000yqn.googlegroups.com>,
>
>
>
>  "laredotorn...(a)zipmail.com" <laredotorn...(a)gmail.com> wrote:
> > Hi,
>
> > I'm usingMac10.6.3.  I thought the way to set global environment
> > variables was to edit my /etc/profile file.  For example, I have this
> > in the file ...
>
> > =========Begin /etc/profile ==============
> > # System-wide .profile for sh(1)
>
> > if [ -x /usr/libexec/path_helper ]; then
> >         eval `/usr/libexec/path_helper -s`
> > fi
>
> > if [ "${BASH-no}" != "no" ]; then
> >         [ -r /etc/bashrc ] && . /etc/bashrc
> > fi
>
> > export JAVA_HOME=/Library/Java/Home
> > export CATALINA_HOME=/Library/Tomcat/Home
> > export PATH=/opt/local/bin:/opt/local/sbin:$PATH
> > export MANPATH=/opt/local/share/man:$MANPATH
>
> > ~
> > =========End /etc/profile ====================
>
> > However, when I restart my system and go into my terminal, I'm not
> > able to echo the values for the variables I defined ...
>
> > -bash-3.2$ echo $JAVA_HOME
>
> > -bash-3.2$
>
> > What am I doing wrong?  Thanks, - Dave
>
> /etc/profile and ~/.profile are only executed in login shells, not
> ordinary shells.
>
> In your Terminal preferences, in the Startup tab, is "Shells open with
> Default login shell" selected?
>
> --
> Barry Margolin, bar...(a)alum.mit.edu
> Arlington, MA
> *** PLEASE post questions in newsgroups, not directly to me ***
> *** PLEASE don't copy me on replies, I'll read them in the group ***

Hi, no I have the command "/bin/bash" because I want bash to be my
default startup shell.

Incidentally, I get a "-bash: /etc/profile: Permission denied" error
when I fire up the terminal application. Thanks for additional help,
- Dave
 |  Next  |  Last
Pages: 1 2 3
Prev: webkitpluginhost
Next: Security update 2010-03 released