ITerm2 login fails after update

iterm

Problem:
After updating iTerm2 to version 3.3.6, I started getting the following message whenever opening iTerm2 or opening a new tab in iTerm2.

Login incorrect
login:

I could then login and use the iTerm as normal, but would get the same message and prompt whenever opening a new tab.

Workaround: If I go to Preferences > Profiles and change the Working Directory setting from "Home directory" to "Directory:", then enter the path to my home directory, this fixes the problem.

Question: I'm trying to understand and fix the underlying problem. Given the above workaround, it seems that iTerm2 thinks my home directory is somewhere else. Any ideas?

Extra details: I'm running MacOS 10.14.5. My username and home directory contains a space. Someone suggested that this might be part of the problem, but if the space is causing a problem, that doesn't explain why it only became an issue after updating iTerm.

Best Answer

Go to Preferences > Profiles and change the Working Directory setting from "Home directory" to "Directory:", then enter the path to your home directory. If your home directory contains spaces or special characters, this might fix the problem.

However, this doesn't explain the underlying cause of the problem, and is not an ideal solution. I'm posting this as the answer since it has worked for at least two people.