Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Why is it when I copied the C compiler tools from the Xcode application folder to usr/bin (which is one of the $PATH for Mac OS X), Terminal doesn't seem to be able to see it? Running a find command on it yields no results: "./gcc: No such file or directory". Executing the command that I know is in usr/bin according to Finder brings the error: "./gcc: No such file or directory"

share|improve this question

3 Answers 3

You seem to be running ./gcc. In the *nix world, ./ means "the current directory". So, when you run ./gcc you are telling the OS to look for an executable called gcc which is in the directory you happen to be in. Unless you run the command from /usr/bin, no such executable will be found and you will get an error.

Since you have placed gcc in a directory that is in your path, you don't need to give a full path to access it, just the name. So instead of ./gcc run gcc and it should work.

share|improve this answer

Here's a couple of things to check out:

  1. After moving the binaries, you might have to tell your terminal to re-scan the PATH. Run the command 'rehash' to do that.
  2. You should update your path to point to the tools, not move the tools to point to the path. Update the path by doing this:

    export PATH="${PATH}:/path/to/tools/dir" ; rehash

share|improve this answer
    
+1 for the second point. Adding to the path is the right way (tm). –  Hennes Jul 28 '13 at 16:40

If you put the executable in /usr/bin ,you can access it by , just using 'gcc' No need for './'. Also the permission of newly added command should be 755.

chmod 755 /usr/bin/command_name
share|improve this answer
    
Keep in mind though it's not wise to give all programs you move 755 permissions. –  ekaj Jul 28 '13 at 16:24

Your Answer

 
discard

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.