Why does iterm2 close new sessions immediately?

I've made some changes to my .bashrc file in my new MacBook, mainly aliases for common commands.

Shortly after, iterm2 immediately closes every new session or tab with the following cryptic message:

## exec failed ##
argpath= error=No such file or directory

Notes:

  • terminal works fine.
  • I've tried to rename .bashrc and relaunch iterm, but the problem persists.

Solution 1:

The default shell was a command shell without command, not a login shell.

Solution:

iTerm->Preferences->Profiles->General->Command

Set radio button to Login shell

Solution 2:

For some others go to iTerm > Preferences > Profiles > General > Command.

If the radio button is ‘Login shell’ change the radio button to ‘Command’ and enter

/bin/bash -l

Should look something like this:

Solution 3:

Given the error message, you are trying to assign some value to the argpath variable, but you have a space after the = -- no spaces allowed there.