Skip to content

EACCES: permission denied, mkdir '/Users/user/.local/share/opencode' #6343

Closed as not planned

Description

@xboxfanj

Description

Same as #2417, installed on macOS using brew. I believe this may be because .local/share already existed since I had PowerShell and uv installed, which use the same path. I used the commands posted at #2417 to fix it and that worked (had to run chown with sudo), but this is likely to happen for others as well, so perhaps it can be fixed, worked around, or documented better. A different path such as ~/.opencode may be better since it won't conflict with anything else. Otherwise, it could be added to the troubleshooting section of the site or fixed in a different way.

opencode
EACCES: permission denied, mkdir '/Users/jake/.local/share/opencode'
path: "/Users/jake/.local/share/opencode",
syscall: "mkdir",
errno: -13,
code: "EACCES"

OpenCode version

1.0.207

Steps to reproduce

  1. brew install opencode
  2. opencode

Screenshot and/or share link

No response

Operating System

macOS 26.2

Terminal

macOS Terminal

Activity

  1. github-actions commented on Dec 29, 2025

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    The issue mentions that .local/share already existed from other tools (PowerShell, uv), which caused permission conflicts. Issue #2417 has documented workarounds and solutions.

    Feel free to ignore if your specific case differs from these.

  2. added a commit that references this issue on Dec 29, 2025
    c64af71
  3. justfortheloveof commented on Dec 31, 2025

    @justfortheloveof
    Contributor

    Why did you have something in your home directory that your user doesn't have access to? Seems like an environmental issue.

  4. LaiZhou commented on Jan 5, 2026

    @LaiZhou

    @xboxfanj alias opencode='XDG_STATE_HOME=$HOME/.opencode-state opencode' It works.

  5. hrivera-ntap commented on Feb 4, 2026

    @hrivera-ntap

    Why did you have something in your home directory that your user doesn't have access to? Seems like an environmental issue.

    In some companies (like mine), local workstations are managed by IT departments that sometimes lock down various directories inside the primary user's home dir (like ~/.local and ~/.cache)

    Having some easy mechanism to override this to a different folder would make this tool usable for a wider audience that are operating in restricted ecosystems

  6. LaiZhou commented on Feb 5, 2026

    @LaiZhou

    @hrivera-ntap try alias opencode='XDG_STATE_HOME=$HOME/.opencode-state opencode' , you can use XDG_STATE_HOME.

  7. hrivera-ntap commented on Feb 28, 2026

    @hrivera-ntap

    @hrivera-ntap try alias opencode='XDG_STATE_HOME=$HOME/.opencode-state opencode' , you can use XDG_STATE_HOME.

    Thanks LaiZhou,

    Though i needed to do the following XDG_* variables to get it to work:

    alias opencode='XDG_CACHE_HOME=$HOME/.opencode/cache XDG_DATA_HOME=$HOME/.opencode/share XDG_STATE_HOME=$HOME/.opencode/state opencode'
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions