2

I have a MacBook with macOS Sierra (10.12.6) installed on it. Something has happened to Terminal, and I can't use it anymore. This is the message I get whenever I open Terminal.

Last login: Fri Oct 27 15:52:59 on ttys000
-bash: /etc/profile: line 1: syntax error near unexpected token `('
-bash: /etc/profile: line 1: `-e \n-e \n# System-wide .profile for sh(1)\n\nif [ -x /usr/libexec/path_helper ]; then\neval `/usr/libexec/path_helper -s`\nfi\n\nif [ "${BASH-no}" != "no" ]; then\n[ -r /etc/bashrc ] && . /etc/bashrc\nfi\nPT7HOME=/opt/pt\nQT_DEVICE_PIXEL_RATIO=auto'
-bash-3.2$ 

Most commands don't work in this mode, and I tried to use su - root, but I get the same error above.

I also used the "pwd" command and it tells me that I'm in my user's home folder.

Any ideas?

2

Something has modified /etc/profile and left it with syntax errors. You need to open it in an editor, correct the problems, and save it. Or, find out why it's changed and undo the edits.

It looks, at a guess, as though something has added -e twice to the top of the file. I don't know what would normally be in that file but a quick check online suggests it should have # System-wide .profile for sh(1) as the first line.

You'll need to make sure nothing else has changed accidentally.

1

I have fixed my issue.

I replaced every \n with a line break, also deleted those two -es from the first line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.