I think the problem is fixed:
This is really nice but i need a bit more help.
Whenever i used to type ‘echo $PATH’
only ever got back my old PATH – which i found impossible to change
Until now!
I created a .Profile file in my root directory (Mac
??
I copied my text edited file **
Now my echo $PATH reads perfect when I ask Terminal 'echo $PATH'
My questions are:
1.If you don’t have a .profile file in the correct place (what is the correct place? See Q2.)
When your account is created, you are assigned a home directory for that account. It is typically /Users/<account name>.
You can see your accounts root directory by typing "echo $HOME"
2.What is the root directory the .profile - .bash_login - .bash_profile files should be in? is it MAC or MAC/users/myname/
/Users/myname or whatever the $HOME variable equates to
3.What are the possible locations that terminal reads and writes to when you type in ‘echo $PATH’ and sudo vi .bash_login (to edit this path)
OR what file is it reading to show you your $PATH!!! (because i was not able to change a file which reflected a change in $PATH in terminal
(i have not found an answer to this question in 2 days of looking in forums)
Re-read my post from above. Basically when you setup your account, you tell the system what your default shell is. In OS X, the default is bash and there really isn't any reason to change it.
When you start terminal, the system knows you want a bash shell, so it actually launches the bash shell for you.
You can verify this by typing in "ps" at the command prompt. You should see:
PID TTY TIME CMD
909 ttys000 0:00.01 login -pf myUserName
913 ttys000 0:00.02 /bin/bash
915 ttys000 0:00.00 ps
Typically, when you modify a global profile, anybody who logs in will get what is contained in those files. Usually, admins put a very small set of things in those files (like the path to basic shell commands, etc).
So every account on the node will get whatever is defined in
/etc/profile
anyone using bash will get what's contained in
/etc/bash_profile
/etc/bashrc
Once the global definitions are executed, it looks in the $HOME variable to find the YOUR root directory and looks for certain files. If they exist, it executes them.
$HOME/.profile - will get executed by sh, bash or ksh shells when they are started.
$HOME/.bash_profile
$HOME/.bashrc
So since you edited both the global and the local .profile, you are seeing
/usr/soylatte16-1.0.2/bin:/usr/soylatte16-1.0.2/bin:/bin:/sbin:/usr/bin:/usr/sbin
You shouldn't really change the global version, but if it's your machine, it doesn't really matter.
In response to your other question, when you make a change, you need to re-login for the change to take effect, or you need to re-execute what you just changed.
So if you edited .profile, you can execute it in the current shell by:
". .profile" (Thats dot<space>.Profile)
Now i have .profile files everywhere!!!
I just have big problems understanding what Terminal is editing and showing when you edit the $PATH via the sudo vi .bash_login OR sudo vi .bash_profile (my files were never showing a universally similar PATH)
Some people on several forums think that when you edit the $PATH variable via the sudo vi .bash_profile OR sudo vi .bash_login.
OR where the $PATH is located is in the following places
/usr/share/init/tcsh/login
/etc/rc.common
/etc/csh.cshrc
/etc/profile
/users/myname
/
Why is it so hard for me to understand what Terminal is REALLY showing when you type in echo $PATH
OK, here's what your missing. When bash reads the file, it is done with the file. When you define $PATH in the file, it copies it from the file into memory. You can look at all the definitions with the "set" command.
So, when you echo $PATH, its looking at the memory version always.
If you edit a file, you need to re-execute the file to copy it into memory.
Sometimes you want the definition to remain only for the time this terminal window is open, so you can modify it at the command line and change only the memory version.
ie.
$ export PATH=$PATH:/someTemporaryDirectory
when you close the terminal window, it will dissapear.
So in short, if you define PATH in /etc/profile, everybody on the box gets it
export PATH=/bin /usr/bin /sbin
When you *Modify* it in /Users/myAccount, only you get it
export PATH=$PATH /usr/soylatte16-1.0.2/bin
when you echo $PATH, you will get
/bin /usr/bin /sbin /usr/soylatte16-1.0.2/bin
If you define the same thing in both places, you will get 2 copies of the same directory, which you found out when you modified both global and local profiles with the same PATH definition.