Not able to set environment variables using .profile file.

S

Shambhavi

Guest
Hi,
I am trying to install Qt3.3.6 on my system. This requires a few variables to be set.

Now the install manual instructs to create a .profile file (since my
shell is bash) and set the environment variables there.
I created the .profile in /Users/xyz as follows:

QTDIR=/Developer/qt
PATH=$QTDIR/bin:$PATH
DYLD_LIBRARY_PATH=$QTDIR/lib:$DYLD_LIBRARY_PATH

export QTDIR PATH DYLD_LIBRARY_PATH

I saved the .profile file and did a reboot. But the env variables have
not been set?
What is going wrong?
In the terminal $QTDIR is empty and the env command gives the following output:

TERM_PROGRAM=Apple_Terminal
TERM=xterm-color
SHELL=/bin/bash
TERM_PROGRAM_VERSION=133
USER=xyz
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/bin:/sbin:/usr/bin:/usr/sbin
PWD=/Users/xyz
SHLVL=1
HOME=/Users/xyz
LOGNAME=xyz
SECURITYSESSIONID=584bf0
_=/usr/bin/env

Why are the variables $QTDIR and $PATH not updated?
How do I set these variables?

Please help I am newbie to Mac!

Thanks in advance.
 
Joined
Jun 25, 2005
Messages
3,231
Reaction score
112
Points
63
Location
On the road
Your Mac's Specs
2011 MBP, i7, 16GB RAM, MBP 2.16Ghz Core Duo, 2GB ram, Dual 867Mhz MDD, 1.75GB ram, ATI 9800 Pro vid
I cut & pasted that content to a virgin .profile file and it worked properly.

Open a Terminal window and type "echo $SHELL" without the quotes. If your really in the bash shell you'll see /bin/bash displayed.

If not, I can tell you how to fix it.

If your in the bash shell then type "cat .profile" to recheck the file.

By the way, unless the qt development path has substitutions for commands in the regular path, I'd set the path as PATH=$PATH:$QTDIR/bin
 
OP
S

Shambhavi

Guest
echo $SHELL did give me
/bin/bash

while cat .profile gave
cat: .profile: No such file or directory.

While I can see the file being present (I have my show all files option of the Finder property turned ON)

The way i created my .profile was went to TextEdit pasted the content that goes into it. Saved it as .profle (the format was RTF the default) in my Users/<myUserName> folder. i.e in my $HOME folder.
 
OP
S

Shambhavi

Guest
Thanks a lot xstep for ur cues. I got it solved. The problem was with i saved the file in RTF format.
I recreated the file using VIM and now the variables are set.

:) Thank U!
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top