Mac Terminal : /dev/fd/12:18: command not found: compdef

I have noticed when I do open it I am always greeted with an error message (see attached). I have no idea how or when exactly it started showing up but I noticed it fairly recently. It also is there on new Terminal tabs and I can get rid of it by using the "clear" command. Is there a way to get rid of the message.

MacBook Pro 16″, macOS 12.6

Posted on Sep 27, 2022 05:09 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 20, 2022 02:21 AM

For me it was the line below in the .zshrc file. For those that don't know you can find this as a hidden file ('Command' + 'Shift' + '.' to reveal) in your user directory. Remove or comment this line in a text editor or IDE of your choice.

# Load Angular CLI autocompletion.
source <(ng completion script)


8 replies

Jan 23, 2023 06:09 AM in response to simple_tech

I have the same issue this work for me.


Follow these steps to install nvm using homebrew


https://www.wdiaz.org/how-to-install-nvm-with-homebrew/


Confirm echo $HOME/.nvm returns

/Users/{your username}/.nvm


Now let’s edit zshrc to add nvm bash_completion with your fvrt IDE


vi ~/.zshrc


Add the following lines to the top of the file


"export NVM_DIR="$HOME/.nvm"

[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm

[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

autoload -Uz compinit

compinit"


Note: Make sure you add this snippet before any call to compdef else you will still see the error


Reload the terminal and the errors should be gone

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.

Mac Terminal : /dev/fd/12:18: command not found: compdef

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