How to add a directory to the $PATH on Terminal?

Discussion in 'Mac Programming' started by SBR210, Sep 13, 2010.

  1. macrumors newbie

    Joined:
    Sep 13, 2010
    #1
    I've just created a new directory but when I attempt to run programs from the Terminal it won't work because the new directory is not in my $PATH. Can anyone tell me the simplest way to add a directory to the path without messing up any of the existing settings?

    Thanks.
     
  2. 4np
    macrumors 6502a

    4np

    Joined:
    Feb 23, 2005
    Location:
    The Netherlands
    #2
    export PATH=/new/path1:/new/path2:$PATH

    if you want it to stick, put it in your .profile (~/.profile that is) ... :)
     
  3. macrumors 603

    Cromulent

    Joined:
    Oct 2, 2006
    Location:
    The Land of Hope and Glory
    #3
    Assuming of course you are using BASH or the Bourne Shell.
     
  4. 4np
    macrumors 6502a

    4np

    Joined:
    Feb 23, 2005
    Location:
    The Netherlands
    #4
    true ;) But as BASH is the most common shell, I bet that's the case :)
     

Share This Page