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

Open
opened 2026-02-16 17:42:05 -05:00 by yindo · 5 comments
Owner

Originally created by @xboxfanj on GitHub (Dec 29, 2025).

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

Originally created by @xboxfanj on GitHub (Dec 29, 2025). ### 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
yindo added the bug label 2026-02-16 17:42:05 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Dec 29, 2025):

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

  • #2417: EACCES: permission denied, mkdir '/Users/user/.local/share/opencode' (original reported issue with same exact error)
  • #5238: Where is the opencode auth.json stored when installed by brew on Linux? (related to the same .local/share directory permissions issue)

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.

@github-actions[bot] commented on GitHub (Dec 29, 2025): This issue might be a duplicate of existing issues. Please check: - #2417: EACCES: permission denied, mkdir '/Users/user/.local/share/opencode' (original reported issue with same exact error) - #5238: Where is the opencode auth.json stored when installed by brew on Linux? (related to the same .local/share directory permissions issue) 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.
Author
Owner

@justfortheloveof commented on GitHub (Dec 31, 2025):

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

@justfortheloveof commented on GitHub (Dec 31, 2025): Why did you have something in your home directory that your user doesn't have access to? Seems like an environmental issue.
Author
Owner

@LaiZhou commented on GitHub (Jan 5, 2026):

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

@LaiZhou commented on GitHub (Jan 5, 2026): @xboxfanj `alias opencode='XDG_STATE_HOME=$HOME/.opencode-state opencode'` It works.
Author
Owner

@hrivera-ntap commented on GitHub (Feb 4, 2026):

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

@hrivera-ntap commented on GitHub (Feb 4, 2026): > 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
Author
Owner

@LaiZhou commented on GitHub (Feb 4, 2026):

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

@LaiZhou commented on GitHub (Feb 4, 2026): @hrivera-ntap try ``` alias opencode='XDG_STATE_HOME=$HOME/.opencode-state opencode' ```, you can use XDG_STATE_HOME.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3955