Whenever I open my terminal on my Mac I get this:

login: illegal option -- e
usage: login [-pq] [-h hostname] [username]
    login -f [-lpq] [-h hostname] [username [prog [arg ...]]]

[Process completed]

All of the fixes I've tried aren't working. I've tried deleting my preferences for the terminal, changing my shell, and deleting my terminal profile.

How can I resolve this error and get a working shell?


2 Answers 2


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.

  • Warning: changing an account's short name (its "Account name") will cause it to loose admin rights; this is not mentioned in the Apple support document. To change an admin account's name, I recommend 1) creating a new temp admin account; 2) removing admin rights from your regular account; 3) renaming the account (see Apple support doc); 4) re-granting admin rights under the account's new name; 5) testing the renamed account (including its admin rights); and optionally 6) deleting the temp admin account. Dec 21, 2019 at 18:59
  • 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)

You must log in to answer this question.

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