

Execute this command in Terminal to move into your home directory.In which case, you need to first make sure the $PATH where commands reside is configured with the following steps: However, if the path where the command you want to execute is located isn't set, you will get the "command not found" error on Mac, such as "zsh: command not found" or "zsh: command not found ls". With $PATH, your Mac knows where to search for executing a command, so you don't need to enter the absolute path of the command but the name only like ls. Similarly, the PATH system variable ($PATH) for Terminal commands specifies several directories where the executable programs lie. Set $PATH as the default macOS pathĪ path refers to a specific location in a file system. Besides, comparing your command with other examples using the same command will also help. It's best to copy the original text into Terminal rather than type it yourself. So, the first thing you should check when encountering the "command not found" error on Mac's Terminal is the command's syntax. That's because the $ is simply a sample Terminal prompt in the documentation that doesn't need to appear in the command.
BREW NOT FOUND MAC INSTALL
Or you may copy and paste a line like $ brew install pyqt into Terminal, which only returns the error: "-bash: $: command not found" on Mac. For instance, you may enter sudo nano/private/etc/hosts to edit the Host files with Nano when the correct syntax has a space after nano, which should be sudo nano /private/etc/hosts. Users unfamiliar with the commands often make mistakes like forgetting to include a space at where it's required or adding unnecessary symbols into the command. Fix 4: Reinstall macOS or restore from Time Machine.Fix 2: Set $PATH as the default macOS path.It's recommended to try them one by one until the command can be executed successfully. Fortunately, these errors usually can be solved by the following solutions.
