Neovim treesitter can't find libc++.1.0.dylib file

I updated my flakes recently & started to get this error in neovim only inside TypeScript files.

Error executing vim.schedule lua callback: Failed to load parser: uv_dlopen: dlopen(/Users/ahmedelgabri/.config/nvim/pack/packer/start/nvim-treesitter/parser/typescript.so, 0x0001): Library not loaded: /nix/store/z9m4v69qwxhfj89619aax0k7595r12wl-libcxx-11.1.0/l
ib/libc++.1.0.dylib
  Referenced from: /Users/ahmedelgabri/.dotfiles/config/nvim/pack/packer/start/nvim-treesitter/parser/typescript.so
  Reason: tried: '/nix/store/z9m4v69qwxhfj89619aax0k7595r12wl-libcxx-11.1.0/lib/libc++.1.0.dylib' (no such file), '/usr/local/lib/libc++.1.0.dylib' (no such file), '/usr/lib/libc++.1.0.dylib' (no such file)
stack traceback:
        [C]: in function '_ts_add_language'
        ...0.7.0/share/nvim/runtime/lua/vim/treesitter/language.lua:33: in function 'require_language'
        ...nwrapped-0.7.0/share/nvim/runtime/lua/vim/treesitter.lua:39: in function '_create_parser'
        ...nwrapped-0.7.0/share/nvim/runtime/lua/vim/treesitter.lua:94: in function 'get_parser'
        ...cker/start/nvim-treesitter/lua/nvim-treesitter/query.lua:138: in function 'prepare_query'
        ...cker/start/nvim-treesitter/lua/nvim-treesitter/query.lua:343: in function 'iter_group_results'
        ...cker/start/nvim-treesitter/lua/nvim-treesitter/query.lua:354: in function 'collect_group_results'
        ...cker/start/nvim-treesitter/lua/nvim-treesitter/query.lua:45: in function 'update_cached_matches'
        ...cker/start/nvim-treesitter/lua/nvim-treesitter/query.lua:53: in function 'get_locals'
        ...ker/start/nvim-treesitter/lua/nvim-treesitter/locals.lua:52: in function 'get_scopes'
        ...im/pack/packer/start/nvim-cmp/lua/cmp/config/compare.lua:181: in function 'update'
        ....config/nvim/pack/packer/start/nvim-cmp/lua/cmp/init.lua:290: in function 'callback'
        .../nvim/pack/packer/start/nvim-cmp/lua/cmp/utils/async.lua:122: in function <.../nvim/pack/packer/start/nvim-cmp/lua/cmp/utils/async.lua:120>

When I check file /nix/store/z9m4v69qwxhfj89619aax0k7595r12wl-libcxx-11.1.0/ there is no such folder

/nix/store/z9m4v69qwxhfj89619aax0k7595r12wl-libcxx-11.1.0/: cannot open `/nix/store/z9m4v69qwxhfj89619aax0k7595r12wl-libcxx-11.1.0/' (No such file or directory)

I had this problem too. I uninstalled all the the treesitters lib:

:TSUninstall all # this is inside neovim, I think you can uninstall only the typescript one

And installed all again:

:TSInstall all # this is inside neovim, I think you can install only the typescript one
1 Like

Thanks, @brogos!

It’s odd though because I tried :TSUninstall typescript & then installed it again & that didn’t work. Maybe something in my setup will check.