1

I've just created my first Command Line Tool in Xcode.

What do I have to do, or where do I have to put the final output file, so that I can run it from anywhere from within terminal, without having to go to the directory the actual Unix Executable File is in.

An example of this is the Java and Git executables, which I can run in the terminal regardless of the location I'm in.

3

You can add the location into your executable path.

Step 1: Use an editor to open ~/.profile

Step 2: Add the actual path into the file. For example, I added /Users/work/documents/fun/scripts into it and my ~/.profile looks like

export PATH=/usr/local/sbin:/opt/local/bin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/Users/work/documents/fun/scripts:$PATH

Step 3: Restart terminal, and issue which command. You should see the path of your program, and should be able to run the program regardless of your location.

which git
=> /usr/bin/git

Or another way, move the program into the existing executable path. To see existing executable path.

echo $PATH

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .