Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's suppose i have an application in /Applications/MacPorts/KDE4/

When i use cd to reach the directory 'MacOS' and then issue the command myapp it says command not found.

But when i issue the command with the full path like /Applications/MacPorts/KDE4/ it works.

I had the same problem with mysql inside xampp.

Why is that?

share|improve this question
up vote 4 down vote accepted

bash in Terminal uses the content of $PATH to look for executables. Usually . (for the current directory) is not part of $PATH (primarily for security reasons), to run commands in the current directory type ./myapp.

share|improve this answer
yes that was it. I hadn't thought of that but it is very logical. Both answers are the same. I didn't know which to accept so i accepted the one submitted first. – tioschi Dec 9 '12 at 20:03

This is because when you type "myapp" is not in the current path, just because you cd into a directory does not mean it will be on the path to run the program.

You need to type ./myapp or add "./" to your path so that your shell will look in the current directory for "myapp" etc.

share|improve this answer
I strongly recommend against adding . to $PATH. A simple malicious ls placed in a public directory can lead to a lot of problems. – patrix Dec 9 '12 at 19:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.