From: Paul Sture 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

Rather than restarting the system, simply create a new Terminal window
(command-N in a Terminal window) to see if it has taken effect. This is
faster than restarting.

You can also use the 'source' command to execute modified bash profiles
in your current shell (i.e. without creating a new one)
For example:

source /etc/profile
echo $JAVA_HOME
/Library/Java/Home

--
Paul Sture
From: laredotornado on
On Apr 15, 8:10 am, Paul Sture <paul.nos...(a)sture.ch> wrote:
> In article
> <545ec116-c67d-4505-8fbe-0fb29c212...(a)i37g2000yqn.googlegroups.com>,
>
>
>
>  "laredotorn...(a)zipmail.com" <laredotorn...(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
>
> Rather than restarting the system, simply create a new Terminal window
> (command-N in a Terminal window) to see if it has taken effect. This is
> faster than restarting.
>
> You can also use the 'source' command to execute modified bash profiles
> in your current shell (i.e. without creating a new one)
> For example:
>
>     source /etc/profile
>     echo $JAVA_HOME
>     /Library/Java/Home
>
> --
> Paul Sture

Thanks for this shortcut. As it happens the problem was that read
permissions for /etc/profile were only set for the owner and not for
group or anyone else. Thanks, - Dave
From: Warren Oates on
In article
<545ec116-c67d-4505-8fbe-0fb29c2127c2(a)i37g2000yqn.googlegroups.com>,
"laredotornado(a)zipmail.com" <laredotornado(a)gmail.com> wrote:

> 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

In your home directory (User/you) create a file called .bash_profile,
and put this in it:

if [ -f ~/.bashrc ]; then
source ~/.bashrc
fi

Then create a file called .bashrc and put your stuff like

> 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


in .bashrc. I'd do this though:

JAVA_HOME=/Library/Java/Home
PATH=/opt/local/bin:/opt/local/sbin:$PATH
export JAVA_HOME PATH

and so on.

Note the dots which start the files. Leave the /etc/profile file alone.

There's some old unixie reason why you do it this way.
--
Very old woody beets will never cook tender.
-- Fannie Farmer
From: Paul Sture on
In article <4bc74222$0$15760$c3e8da3(a)news.astraweb.com>,
Warren Oates <warren.oates(a)gmail.com> wrote:

> in .bashrc. I'd do this though:
>
> JAVA_HOME=/Library/Java/Home
> PATH=/opt/local/bin:/opt/local/sbin:$PATH
> export JAVA_HOME PATH

I've always done it like this:

JAVA_HOME=/Library/Java/Home; export JAVA_HOME
PATH=/opt/local/bin:/opt/local/sbin:$PATH; export PATH

which keeps related variables on one line.

Your method looks a lot less cluttered though.

--
Paul Sture
From: Barry Margolin on
In article
<bf3eb3be-34a3-4666-bc93-0e46dcd63793(a)x3g2000yqd.googlegroups.com>,
"laredotornado(a)zipmail.com" <laredotornado(a)gmail.com> wrote:

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

Ever since Panther, bash has been the default login shell. If your
login shell is something else (perhaps you've been upgrading since
before Panther, and inherited your earlier shell), see this page for how
to change it:

http://mactips.dwhoard.com/home/system/change-default-shell

--
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 ***
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: webkitpluginhost
Next: Security update 2010-03 released