How To Save Path when setting new env variable!!

Hello all,

I am trying to learn how to properly include something in my path. When I run the command echo $PATH, I get /Xcode3.12/usr/bin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbi n:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/ opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin,,,,,how ever, as soon as I leave the Terminal and relaunch it and retype the echo $PATH command I no longer see what I just included in the path before logging out. This is what i do first:

export PATH=/Xcode3.12/usr/bin:${PATH}
export PATH
export MANPATH=/Xcode3.12/usr/share/man:{MANPATH}
export PATH

After typing this in the Terminal, I exit the Terminal and it is no longer there. Can anyone explain to me how I go about saving this so it remains permanently part of the PATH. The reason why I'm asking about this is I am trying to install OpenMotif and it is asking me to add the lib path to the DYLD LIBRARYPATH envi.,, I have no idea what this is. Any help would be greratly appreciated.

Best Regards,

freesparks

Mac Book Pro, Mac OS X (10.6.1), Mac Book Pro 3.06 @ 4GB 128 SSD

Posted on Feb 18, 2010 7:56 AM

Reply
23 replies

Feb 18, 2010 8:13 AM in response to freesparks

Unfortunately, you seem to have a number of problems.

First of the list is /opt. That is one of those "ports" packages isn't it? It would have been better to have asked about OpenMotif first. Now you have to figure out how to fix your system, then get back to worrying about OpenMotif. Some people here will help with those "ports" packages, but I won't. I consider them 3rd party software and very troublesome ones at that.

Next it Xcode. "/Xcode3.12" is a very unusual place for it. I suppose you could install it there and make it work, but you would really have to know Xcode and paths really well to make it work.

Finally, on MacOS X, there are much better ways to set your paths than on Linux. Instead of hacking up your dotfiles. Look at "man path_helper"

Feb 18, 2010 8:31 AM in response to etresoft

Hello etrersoft,

Yes, it is a port package. As far as Xcode goes, the reason I did that is because I have 2 different versions of Xcode on my machine. Xcode 3.2.1 is installed in /Developer. I opted to put Xcode 3.12 in /Xcode3.12 to keep it seperate from the more recent 3.2.1 version. Should it be placed inside the /Developer directory along with the other newer version of Xcode? My understanding of getting it to work is just a matter of including the path in the PATH line and saving it.

Best Regards,

freesparks

Feb 18, 2010 8:48 AM in response to freesparks

freesparks wrote:
Yes, it is a port package.


Do you need it? From what I've seen, they seem to cause far more problems than they solve.

As far as Xcode goes, the reason I did that is because I have 2 different versions of Xcode on my machine.


Again, do you need that?

Should it be placed inside the /Developer directory along with the other newer version of Xcode?


You can put it wherever you want, but not, I think in /Developer. That belongs to your other Xcode. I don't have multiple versions of Xcode installed, so I'm no expert.

My understanding of getting it to work is just a matter of including the path in the PATH line and saving it.


There is a little more than that. Look up the "xcode-select" tool. Look at this thread for more information.

PS: As I look at that thread, I see you were the one I was working with then too. Did something break?

Feb 18, 2010 9:49 AM in response to freesparks

Traditionally, custom environment variable settings
go into your $HOME/.bash_profile

If you need environment varialbles set for GUI processes
that do not start from your Terminal sessions, you can
look at a utility called RCEnvironment (it is a 3rd party
System Preference panel). This creates and maintains a
$HOME/.MacOSX/environment.plist

If you need environment variables set for every
process/daemon, that is knowledge beyond my pay grade 🙂

Feb 18, 2010 11:09 AM in response to freesparks

Hello Bob,

This is the issue I'm having. I can't find the .bash_profile file you are referring to. This is exactly what I found on some of the on-line literature I haver read. Where on earth is this file. I looked in my HOME directory, with all the hidden files exposed and I cannot find it. The docs in the instruction I read on-line just says to add the path to this file so that it permanently remains part of the path.
Any help on this would be greatly appreciated!!

Best Regards,

freesparks

Feb 18, 2010 11:35 AM in response to freesparks

This is the issue I'm having. I can't find the .bash_profile file you are referring to.

So create it.

You are in the Unix world. We use clubs, stone tools, and "Grunt" a lot 🙂

I would suggest using the nano editor

nano $HOME/.bash_profile

Make your PATH changes.

Now either exit from the Terminal and start over again, or source the new .bash_profile

source $HOME/.bash_profile
echo $PATH

Feb 18, 2010 12:49 PM in response to etresoft

Bob,
Have you used path_helper? I much prefer it to hacking around on config files.

No, and I'm unlikely to use it, as I concurrently live on Mac OS X, Linux, Solaris, and AIX. In the past I also had HP-UX and Tru64 UNIX.

I use the exact same .bash_profile and .bashrc also .vimrc files on ALL those systems. In some cases via NFS, $HOME is the same on Linux, Solaris and AIX.

In addition, I'm only a guest on some of those platforms, so changing entries in /etc is not an option.

I get paid to use clubs, stone tools, and "Grunt" 🙂

Of course I do have a 27" iMac and a dual headed PowerMac G5 (using Teleport) as my window into this Unix world, so I do get to use the "say" command for grunting

say grunt

🙂

Feb 18, 2010 12:52 PM in response to BobHarris

Hello Bob,

You have to forgive me. You're talking to someone that was never comfortable in jumping in the command line. And then I read Neal Stephenson's book, now I'm hooked; so please forgive my ignorance. I did as you said and now each time I launch a new Terminal window this is what I'm getting:

Last login: Thu Feb 18 15:36:30 on console
-bash: /sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin: /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/op t/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R 6/bin:/Xcode3.12/usr/bin:/Xcode3.12/usr/share/man: No such file or directory
NEVSLAVE:~ neduret$ ls


Is this normal? And, if it isn't how do I undo it? This is the result ourcing the new .bash_profile file. Again, I appreciate all of you guys' help. I went ahead and reinstalled Xcode3.2.1 and now the commands are working however I am getting an error having to do with:

checking for Motif headers... configure: error: ** NO MOTIF HEADERS FOUND ** install Motif development headers or use --with-motif-includes to specify location of Xm/Xm.h


,,whatever this means. I think the reason why I'm still having some issues is incompatibility issues.. Earlier on in the code when I went to ./configure xastir, I got this after I ran this command:

sudo /opt/local/bin/port install curl imagemagick openmotif pcre db42 lcms proj gdal libpng libxml2 shapelib libgeotiff

Error: You cannot install fontconfig for the architecture(s) x86_64 because
Error: its dependency expat only contains the architecture(s) i386.
Error:
Error: Did you upgrade to a new version of Mac OS X? If so, please see
Error:
Error: http://trac.macports.org/wiki/Migration
Error:
Error: Target org.macports.configure returned: incompatible architectures in dependencies
Error: The following dependencies failed to build: fontconfig jpeg lcms tiff libpng libxml2 p7zip xorg-libXt xorg-libsm xorg-libice
Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.

Anyway, again, I appreciate all the help, thanks etresoft for your continued help!!

Best Regards,

freesparks

Feb 18, 2010 1:24 PM in response to freesparks

freesparks wrote:
I did as you said and now each time I launch a new Terminal window this is what I'm getting:

Last login: Thu Feb 18 15:36:30 on console
-bash: /sw/bin:/sw/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin: /opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/op t/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/X11R 6/bin:/Xcode3.12/usr/bin:/Xcode3.12/usr/share/man: No such file or directory


You are going to have to post the contents of your .bash_profile file. Make sure to put it between two lines of:

so it will display nicely here in the forums.

Is this normal? And, if it isn't how do I undo it? This is the result ourcing the new .bash_profile file.


It isn't normal. You have some duplicates in there. Still, you have at least two different ports packages in there. Even when correct, your path is going to be pretty long.

You normally shouldn't source .bash_profile. It is loaded automatically when you login. If you keep source-ing it, it will just keep adding junk to your path and other variables.

When hacking around on these files, it is best to keep several (or at least two) terminal windows open. That way, you can hack up a file, then open a new window to check it out. If that new window hangs entirely, you still have one functional window where you can fix it.

checking for Motif headers... configure: error: ** NO MOTIF HEADERS FOUND ** install Motif development headers or use --with-motif-includes to specify location of Xm/Xm.h


sudo /opt/local/bin/port install curl imagemagick openmotif pcre db42 lcms proj gdal libpng libxml2 shapelib libgeotiff


That sounds like you are doing my job!

You don't need curl, it comes with the OS. You don't need libxml2, that comes with the OS too. Same for pcre.

I know imagemagick builds right out of the box on MacOS X. I'm still not convinced you need openmotif. If you do, doug has posted a link to the official installer package for it.

Error: You cannot install fontconfig for the architecture(s) x86_64 because
Error: its dependency expat only contains the architecture(s) i386.


It sounds like the ports packages are all screwed up.

I wasn't kidding about you doing my job. Those are all the tools I use on a daily basis. Normally I work in Linux, but I am supposed to be getting a new Mac soon that I can use for local development. I plan to be building all those tools on my machine, but I won't use any porting package. So, I'll be glad to help you install them, because I need to install them myself (I've already done ImageMagick - it was easy). But I can't fix bugs in the ports packages.

Feb 18, 2010 2:05 PM in response to etresoft

OT - Well if you like that, you use:

say -v Cellos --file-format=AIFF -o newmail.aiff "new mail has arrived"

And then put that file into ~/Library/Sounds, and you can arrange for that to be your New Mail sound from Mail.

And if you are using Google Notifier, you can do the same thing, only specifying --file-format=WAVE and tell Thunderbird to use it as your new mail output.

At work, I use Thunderbird for work email (.aiff file), so it says "Company name Mail", and I then have Google Notifier use a WAVE file to say "Gee Mail". That way I keep my company and personal mail separate, and I know which one has just arrived.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

How To Save Path when setting new env variable!!

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.