-bash: /Users/admin/.bash_sessions/720116FC-4C25-4FFA-AC15-00D5C843C15F.session: line 1: syntax error near unexpected token ('
-bash: /Users/admin/.bash_sessions/720116FC-4C25-4FFA-AC15-00D5C843C15F.session: line 1: echo Restored session: 

Does anyone know how to fix this?

  • What command are you trying to execute? – Allan May 15 '16 at 12:59
  • His question title is 'I get a bash syntax error message every time I open Terminal on macbook'. I don't think he has any starting commands. – Brick May 15 '16 at 13:11

Open /etc/bashrc_Apple_Terminal (requires sudo), replace

echo echo Restored session: $(date) >| "$SHELL_SESSION_FILE"


echo echo \"Restored session: $(date)\" >| "$SHELL_SESSION_FILE"

The point is to quote the echoed message.


This problem is caused by OS X bash session restoration process which inserts in every '.session' file command like this:

echo Restored session: суббота, 25 июня 2016 г. 23:29:08 (MSK)

We should not use symbols like '(' in echo command text without being wrapped in quotation marks, but OS X forgot about it, alas. The only way for me to get rid of this naughty error message is to disable bash sessions at all:

touch ~/.bash_sessions_disable

And it works.


Looks like one of bash's session files got corrupted.

rm  /Users/admin/.bash_sessions/*

should fix this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .