Home / “Error opening terminal xterm-color” on Mac OSX Terminal

“Error opening terminal xterm-color” on Mac OSX Terminal

If you are connecting to a remote server from the Mac OS X terminal and get the message “Error opening terminal: xterm-color” when doing certain operations on the remote server, then you either change your terminal’s declaration setting or add a TERM declaration to the bash profile on the server at the other end to prevent the error message from happening. There may be other ways to solve it at the server end but this post shows a quick and easy fix.

Other operating systems and apps

This may also affect users on other operating systems using SSH to connect to a remote server, but I use a Mac and that’s where I had the issue. If you’re using something else then the setting the TERM section at the end of this post should probably help.

Change the terminal emulation declaration

Open up Terminal’s preferences and click “Settings” then “Advanced”.
This is shown in the screenshot below:

mac osx terminal advanced settings

The section highlighted with the red box is where you can set the terminal declaration. Open up the drop down box and change it to xterm and when you log in to the remote server it won’t show the error about xterm-color.

Setting TERM on the remote server

You can instead change the TERM declaration on the remote server.
Do this on the command line like so:

TERM=xterm

This will take effect immediately for all future commands executed. When you log out and back in again it will revert to the TERM setting your SSH client application had sent the last time. To make the change permanent add the above line to your .bash_profile or .bashrc on the remote server.