terminal command not found: locale and mkdir

Hi, I tried changing the default file path for MySQL to bin and shell to zshell using terminal. Now, when I open up the terminal, I by default get command not found: locale and command not found: mkdir. I suspect there is some issue with the configuration. I tried reinstalling thr macos from the recovrry mode and using the safe mode but the issue still persists. Can anyone suggest t it please. Below is the snapshot.

MacBook Air, macOS 15.3

Posted on Mar 9, 2025 10:32 PM

Reply
3 replies

Mar 10, 2025 12:36 AM in response to Yash_Bhatt_123

I'm running Sequoia 15.3.1, with zsh set as the default shell. These commands are in /usr/bin and /bin, respectively.


% whereis locale
locale: /usr/bin/locale /usr/share/man/man1/locale.1
% whereis mkdir
mkdir: /bin/mkdir /usr/share/man/man1/mkdir.1


I ran locale (since it just displays things) with no problem.


My guess is that something in one of your startup scripts has messed up your PATH, causing /usr/bin and /bin to be excluded from the PATH. If that is the case, that's going to interfere with the execution of a lot of basic commands, not just those two. You may be in for having to supply absolute file paths for many basic commands until you fix it.

Mar 10, 2025 8:38 PM in response to Yash_Bhatt_123

Finally I managed to resolve it. It involved resetting the PATH, removing the MySQL property, reinstalling Nano (as the command itself was corrupted. Followed by installing brew to load and inspect the nano version. Ultimately, I had to fix the error on startup script to fix mkdir on line 104 by running sudo nano /etc/zshrc_Apple_Terminal. It opening the script in the editor and I had to change mkdir -m 700 -p "$SHELL_SESSION_DIR" (line 104) to /bin/mkdir -m 700 -p "$SHELL_SESSION_DIR". and save it.


It involved a couple of hours brainstorming session with AI tool and I would advice anyone to take screenshot of the terminal, upload it to the AI tool, ask for the step by step solution and reiterate until the error is fixed.

Mar 10, 2025 12:41 AM in response to Yash_Bhatt_123

Yash_Bhatt_123 wrote:

I tried reinstalling thr macos from the recovrry mode and using the safe mode but the issue still persists.


My guess is that you reinstalled macOS "in place" (to preserve your data) – rather than wiping the startup volume clean and reinstalling everything from scratch.


Thus, the modified startup script that is failing to set the PATH properly is sticking around and causing the problem. Completely wiping macOS and your data, reinstalling macOS, and then restoring your other data (without restoring the troublesome script file) seems overkill, like using a hammer to swat a fly.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

terminal command not found: locale and mkdir

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.