Search code examples
macosneovim

Neovim permission issue (~/.local) after installing on mac


Just installed neovim on my mac (macOS: Sonoma 14.5, Chip: Apple M2) using homebrew. When I tried to start neovim I get the following error (I replaced my real username with UserName in the path below):

Error detected while processing /opt/homebrew/Cellar/neovim/0.10.0/share/nvim/runtime/plugin/rplugin.vim[68]..function <SNR>12_LoadRemotePlugins[1]..<SNR>12_GetManifest[1]..<SNR>12_GetManifestPath:
line   11:
E739: Cannot create directory /Users/UserName/.local/share: permission denied

To solve this issue I understand that I would need to grant the User "UserName" write permission to the ~/.local directory (probably with sudo: sudo chmod +w ~/.local), but is this safe thing to do? I don't see this step in any neovim installation tutorial I have seen so far.


Solution

  • Everything in your ~ (which is an alias for /Users/yourusername on Mac) should be owned by you by default, because this is your own user's home folder. It is your folder by definition.

    The ~/.local folder is not a standard Mac folder. It was likely created when you installed other software like Vim. If you installed Vim or another program with sudo (which you generally shouldn't need to do) it might have created that folder as root.

    To fix it, reset all the permissions on ~/.local to your own user with chown. The -R flag is recursive to apply to all child directories. Note staff is the default group on Mac OS.

    sudo chown -R yourusername:staff ~/.local