"command not found"

Hi everyone. On MacOS, both within the Terminal window in VS Code, as well as in a standalone terminal, whenever I try to run .\hello, I get an error saying “command not found”. However, when I double-click the executable file in MacOS Finder, it opens a Terminal window and runs without issue!

Screen Shot 2022-08-10 at 12.25.10 AM

I have already done the following:

  1. Switch between Bash shell and ZSH in case the shell I was using had issues.
  2. Reset my PATH variables to default in case I had messed them up in the past
  3. Ensured (many times) that I was within the directory the executable is in on my CLI
  4. Added the folder the executable is in to the PATH in case that would help
  5. Googled and searched on this forum for others with similar issues and found nothing that helped

If anyone has any ideas they’d like to throw my way, I’d really appreciate it. Again, running the executables manually through the GUI works fine, but running it in a CLI fails every time.

Of course, I find the solution as soon as soon as I post this…

For some insane reason, Microsoft’s syntax uses a backslash and POSIX (Unix-like) OS’s like MacOS use a forward slash. So after all I did…it was simply the difference between “.\hello” and “./hello”.

2 Likes

I’m glad that me from the past could help! Lol

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms