1

I want to execute graldew. It is definitely in the same directory and it has all the permission. But when I try to execute it I get command not found. Also I can not even autocomplete it using TAB button.

Could someone explain why is it happening?enter image description here

Kosh
  • 238

2 Answers2

2

It is definitely in the same directory

Unlike Windows, the command-line shell in macOS (and other Unix-like systems) only executes commands found in $PATH and doesn't give any special treatment to "the same directory" – and the current directory is not in $PATH by default.

Files whose location isn't in $PATH can only be run using their exact path: ./gradlew will work for files in the current directory (i.e. .), though full /Users/..../android/gradlew or $PWD/gradlew can be used too.

It is also possible to add . at the end of $PATH, though generally not recommended. (Adding it at the beginning, like in Windows, is very risky as downloaded files could override system commands such as 'ls' or 'rm'; having it at the end – a bit less so.)

grawity
  • 501,077
1

Have you tried ./graldew?

./ represents the current directory

DarkDiamond
  • 1,919
  • 11
  • 15
  • 21
xepa
  • 26