iTerm2 login fails after update

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.


Solution 1:

(Given the age of this question, I'm mostly posting this for others like me that have different circumstances but the same error message.)

I had that same error after my employer changed my username, but migrated all my files to the home directory of the new user. Of course that didn't correct any path references in my files.

I had to hunt through the com.googlecode.iterm2.plist config file for references to my old username. In doing so I found that there was a line containing login -fp "old_username". Changing this to login -fp "new_username" fixed the issue for me. I suspect the quoting for that command is wrong with your username that contains a space.

Solution 2:

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.