adding a file to my path

Discussion in 'Mac Programming' started by jamesapp, Jun 7, 2008.

  1. jamesapp macrumors 6502a

    Joined:
    Mar 7, 2008
    #1
    i have a shell script in a directory on my hard drive.
    it is located in my home directory.
    how do i make this script executable anywhere on my hard drive?
    i am thinking i would have to add this script to my path, but am not sure how to do this.
     
  2. lee1210 macrumors 68040

    lee1210

    Joined:
    Jan 10, 2005
    Location:
    Dallas, TX
    #2
    Open the terminal and create a file called .bash_profile in your home directory.

    Place this line in this file:
    Code:
    export PATH=$PATH:~
    Save the file.

    Any new terminal you open will now have your home directory in the path. So when searching for executables with a name you've provided, that will be one directory (the last one, if you add it exactly as above) that is searched.

    -Lee
     

Share This Page