macoschmod

-bash: chmod +x: command not found . Using the chmod +x command on MacOS gives error


On my MAC, I'm typing in the chmod +x command, and getting the following error -

-bash: chmod +x: command not found

What should be done here?

echo $PATH

/Applications/apache-maven-3.8.4

Solution

  • When you want to use terminal commands normally, your $PATH value should be something like this: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin.

    If you want to keep /Applications/apache-maven-3.8.4 as $PATH for some reason , then you should use

    /bin/chmod +x /Users/someone/Documents/some_file
    

    instead of

    chmod +x /Users/someone/Documents/some_file
    

    Edit:

    The error message included the +x as part of the name of the command that wasn't found

    I figured out, that you can recreate the error by entering this command in the terminal: "chmod +x" test.txt --> zsh: command not found: chmod +x To fix it you should do "chmod" +x test.txt.