How to find and edit the PATH file

Discussion in 'Mac Programming' started by V6Pony, Jun 17, 2012.

  1. macrumors newbie

    Joined:
    Nov 28, 2010
    Location:
    Southern Illinois
    #1
    I'm trying to edit my path from a terminal in Lion. I can use export to get a temp result. I would like to edit the file so the path stays. What is the file name where is it located? I thought it was in .bash_profile or .bashrc. But I can't find these files on my system. :eek:

    Thanks
     
  2. kryten2, Jun 17, 2012
    Last edited: Jun 17, 2012

    macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Try .profile. If the files don't exist, create them like :

    Code:
    [COLOR="Red"]echo[/COLOR] 'export PATH=/path/to/some/dir:$PATH' >> .profile
     
  3. thread starter macrumors newbie

    Joined:
    Nov 28, 2010
    Location:
    Southern Illinois
    #3
    Thanks for you answer kryten2. I'm new at this. I used the find ~/.profile it did not exist. I used the export PATH=/Users/dleathers:$PATH >> .profile . This created the .profile file in my ~. But the path statement is not in the file. Are you saying that I just enter the PATH " as I want it to be" in the .profile with a text editor? Then when I login the path will be read from this file?
     
  4. kryten2, Jun 17, 2012
    Last edited: Jun 21, 2012

    macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #4
    Perhaps you forgot the echo at the front? Now the file exists you can just put in export PATH=/Users/dleathers:$PATH. Note : files with a dot at the front eg .profile are hidden files. If you want to open them with TextEdit do in Terminal :

    Code:
    open -a TextEdit .profile
    or

    Code:
    open -e .profile
    Try and you'll see. Check your path with
    Code:
    [COLOR="Red"]echo[/COLOR] $PATH
    Better use single quotes so we don't get variable expansion eg

    Code:
    [COLOR="Red"]echo[/COLOR] [COLOR="red"]'[/COLOR]export PATH=/path/to/some/dir:$PATH[COLOR="red"]'[/COLOR] >> .profile
     

Share This Page