By default, Mac’s Terminal.app application declares itself to be of terminal type “xterm-color”. You can change this by changing Terminal.app’s default.

Go to Terminal’s Preferences

TerminalPreferencesdefault

Change “xterm-color” to “xterm”.
TerminalPreferencesdesired

Alternatively, one can change their terminal type from the command line by typing:

setenv TERM xterm

(if that doesn’t work, try export TERM=xterm)