I was messing around with ssh keys and permissions and other things I'm not too familiar with and ended up causing some problems on my mac, including denying myself permission to my user account, changing the root directory and other annoyances. Most of the other things were fixed by a restart or fiddling, but I know I get this error message every time I start up a terminal window and can't figure out what to do. How do I get rid of it?

I tried this Terminal returns not found for most commands Mac OSX, but I don't think it's the same error because if I write bash into the terminal it starts a bash interface. Something is entering -bash into the terminal on startup and I can't figure out from where or why?

Last login: Tue Dec  4 08:57:20 on ttys003
Ludos-MBP-3:~ ludo$ -bash
-bash: -bash: command not found
Ludos-MBP-3:~ ludo$

It's also not a duplicate of this -Bash command not found appearing every time I start terminal because I've checked the .bash_profile file and nothing has changed since last time I checked it. I tried all the statements in there and none of them generate that error.

echo $PATH generates

  • Have you checked the terminal settings? shell opens with default or command? what does "which bash" return? Commented Dec 4, 2018 at 12:24
  • If you run cd /, then pwd where is the root now? if the root was messed up it may not be able to find them because of that. Commented Dec 4, 2018 at 12:32

1 Answer 1


Troubleshooting syntax errors in the shell scripts is the fastest way to remove this.

  1. Backup and rename all . files for your shell - .bashrc and .bash_profile

Verify the issue is resolved. Build up your files line by line or by doing a split half search (add half the things the file does at a time - adding / removing half) if your files are very long or involved.

You're in good company on this one:

It doesn't really matter that nothing changes in the file if it sources other files or the global environment has changed - setting aside your files is the fastest way to get to a stable bash (or whatever shell you prefer) and then build things up slowly.

Once you're sure it's not the startup files, then look at the application running. If it's terminal.app - it can be set to run a command or script when it starts - you can remove those preferences or perhaps make a new user account and verify it's either a system wide issue or just restricted to your user account and user preferences.

You must log in to answer this question.

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