MacOS – mkdir: /Users/me/.bash_sessions: Permission denied

command linemacosterminal

When I open terminal now I get always this error message. Any ideas how to fix this?

mkdir: /Users/me/.bash_sessions: Permission denied
touch: /Users/me/.bash_sessions/9F11525D-3E4C-45B5-8FA7-D69A4D2CC5B3.historynew: No such file or directory

Best Answer

~/.bash_sessions is a folder used to store the history of past bash sessions. Apparently the permissions are wrong (however this happened), there are several ways to tackle this:

  • rm -r ~/.bash_sessions Deletes the whole folder, should get recreated with the next Terminal tab/window you open
  • sudo chown -R $USER ~/.bash_sessions; chmod 700 ~/.bash_sessions Tries to fix permissions (sudo only works if you have an account with admin privileges)