ohmyzsh: compinit:480: compdump: function definition file not found

Describe the bug

Everytime I run the zsh command it will gives me the following error

compinit:480: compdump: function definition file not found

Steps to reproduce

zsh

Expected behavior

my oh-my-zsh on terminal works fine after I initiate a new terminal but not Ok when I run zsh, but on vs-code it didn’t even initiate properly, it gives me the error of

compinit:480: compdump: function definition file not found
/Users/tdu1/.sdkman/bin/sdkman-init.sh:194: bashcompinit: function definition file not found
/Users/tdu1/.sdkman/contrib/completion/bash/sdk:82: command not found: complete
/var/folders/lt/9vv4z6ys2cz7b0ry43z0y02h0000gp/T/vscode-zsh/.zshrc:126: add-zsh-hook: function definition file not found
/var/folders/lt/9vv4z6ys2cz7b0ry43z0y02h0000gp/T/vscode-zsh/.zshrc:127: add-zsh-hook: function definition file not found

Screenshots and recordings

No response

OS / Linux distribution

MacOS 12.3.1

Zsh version

zsh 5.9 (x86_64-apple-darwin21.3.0)

Terminal emulator

Terminal.app

If using WSL on Windows, which version of WSL

No response

Additional context

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 10
  • Comments: 35 (12 by maintainers)

Most upvoted comments

I ran across this issue as well.

TLDR; add ZSH_DISABLE_COMPFIX=true to the top of your .zshrc to fix this on MacOS with zsh installed via homebrew.

When running /bin/zsh, it works fine because the fpath is using the system locations. But, /opt/homebrew/bin/zsh fails with compinit:480: compdump: function definition file not found. Looking at the fpath for homebrew’s zsh, it appeared that its fpath locations weren’t present. But, if you try adding them, they get reset:

export fpath=(
   /opt/homebrew/Cellar/zsh/5.9/share/zsh/functions
   /opt/homebrew/share/zsh/site-functions
   $fpath
)
source $ZSH/oh-my-zsh.sh
# oops! fpath is now reset!? What?!

Digging deeper, the issue is with compaudit in Oh My Zsh’s lib/compfix.zsh file. You can disable this functionality by adding ZSH_DISABLE_COMPFIX=true to the top of your .zshrc. The issue is likely due to directory permissions, which can be dealt with by running brew doctor, but if you are on a multi-user system like a family computer, that can be problematic.

The extra .oh-my-zsh entries in $FPATH are standard OMZ stub paths. As for why they are included but not used is a question for the OMZ maintainers.

Nothing in your .zshrc file looks unusual and git reports nothing has been changed in OMZ.

My only guess is the mix in zsh 5.9 and loading files from 5.8. How did you install 5.9 ? Apple wouldn’t have installed zsh in /usr/local/bin

ok solved by brew uninstall zsh.

adding ZSH_DISABLE_COMPFIX=true at the top of my .zshrc file fixed it for me on vscode Terminal. I’m using macos Sonoma 14.0

@scotch83 I also ran into this issue and fixed it by seeing my $FPATH contents outside of vscode:

echo $FPATH | pbcopy

And putting the contents at the top of my ~/.zshrc:

export FPATH=“<paste here>”

This started occurring after upgrading to macOS Sonoma (version 14.0). Apple M1 Pro.

I was prevented from uninstalling zsh via brew uninstall zsh. Instead I removed the path found at ls -la /opt/homebrew/bin/zsh and removed /opt/homebrew/bin/zsh and restarted the terminal to get the macOS-provided version of zsh. 👍

I had the same problem. brew uninstall zsh and rebooting solved the problem for me. Thanks @tdu1-godaddy

I am getting this problem in VSCode’s terminal on an M2 Mac. In the standard terminal, it works fine, and both worked fine on my older Mac

I had the same problem. brew uninstall zsh worked. Thanks @tdu1-godaddy