MacOS terminal "login: illegal option -- e"

The problem is occurring because of an improper account name beginning with the dash ("-") character. So the solution is changing the name of the account via the steps given in this link: https://support.apple.com/en-us/HT201548

When you open the terminal an automatic login command like login -pf [account-name] is executed. Let's say the account name is "-gi". In this case the command will be login -pf -gi and naturally, the terminal will show the error illegal option -- g. Therefore you should change the account name properly.


  • Start Terminal (and ignore the error/terminal output)
  • Type Cmd-, to open Preferences
  • In the General tab, switch the second option to a custom command and use /bin/bash -noprofile -norc as the command
  • Switch back to the Terminal window and type Cmd-T to open a new Terminal tab (which should work now).

Assuming it does

  • Run mv .bashrc{,.OLD}; mv .profile{,.OLD}
  • Switch Preferences back as they have been before
  • Debug whatever is in .bashrc.OLD and .profile.OLD (or just write new files from scratch)