Terminal returns Command not found error for Monterey upgrade

I'm trying to create a bootable installer for Monterey. When I opened Terminal in order to prepare a USB flash drive for this purpose (as per Create a bootable installer for macOS - Apple Support), I was presented with the following:


The default interactive shell is now zsh.

To update your account to use zsh, please run `chsh -s /bin/zsh`.


I ran the command (which resulted in a "Changing shell for david" message) and then pasted the appropriate command:


sudo /Applications/Install\ macOS\ Monterey.app/Contents/Resources/createinstallmedia --volume /Volumes/MyVolume


However, after entering my password, the command was displayed, followed by a "Command not found" error.


Any ideas?


iMac 21.5″, macOS 10.15

Posted on Nov 14, 2023 5:02 AM

Reply

Similar questions

3 replies

Nov 14, 2023 6:39 AM in response to davidneale1

A couple of points:

  1. The /bin/zsh shell does not read the old Bash dot files to get a notion of the correct PATH for commands, and thus, it cannot find /usr/bin/sudo.
  2. Is your mounted USB stick named MyVolume?


In the Terminal, do this:


/usr/bin/more ~/.zshrc


if it reports /Users/david/.zshrc: No such file or directory, then you need a .zshrc file with a PATH statement.


Copy and paste the following into your Terminal and then follow it with a return key. This will write a Zsh dot file in your home directory with a default PATH.


<<"EOF" > ~/.zshrc
export PATH=".:/usr/local/bin:${PATH}"
PS1="%m: %~ %% "
EOF

and follow this also in the Terminal with:


source ~/.zshrc


and that will set your PATH and prompt without having to quit and restart the Terminal application. Then, providing you have the correct USB stick name in your createinstall media syntax, issue that command again, and this time, it will resolve where the sudo command is located.

Terminal returns Command not found error for Monterey upgrade

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