32

When using the terminal in emacs (M-x term) under MacOS for some reason it always posts the characters 4m before every line in zsh and always prints 2 lines containing the user info such as

4m--(jesus@laptop:/dir)----
4m--(jesus@laptop:/dir)----
prompt>

It's more of an annoyance than anything but I was just wondering if there's a way to fix this. I also seem to have issues in Zsh in Mac OS emacs terminal mode when a lot of output is written to it it seems to reduce it all to one line and constantly overwrite the same line (may be related as the 4m is possibly just a special character that emacs is treating differently which can affect formatting).

If need be I can post my .zshrc and .emacs files.

1

3 Answers 3

57

You don't have eterm-color terminfo. First, you try to add following S-exp in your configuration file and evaluate.

;; Use Emacs terminfo, not system terminfo
(setq system-uses-terminfo nil)

If problem is not resolved previous setting, you should create eterm-color terminfo by using following command. (terminfo path may different from your system)

# If you use Cocoa Emacs or Carbon Emacs
tic -o ~/.terminfo /Applications/Emacs.app/Contents/Resources/etc/e/eterm-color.ti
10
  • 3
    Turns out Cocoa Emacs when installed from emacsformacosx.com does not install this file. So if you're using emacs from there, you'll need to run the second command above. Aug 8, 2012 at 3:24
  • 1
    I had to get a copy of the eterm-color.ti from opensource.apple.com/source/emacs/emacs-70/emacs/etc/e/… Oct 19, 2012 at 23:50
  • 1
    Anybody got an update on this? The structure of the Emacs Cocoa app, changed... and eterm-color.ti isn't located at /Applications/Emacs.app/Contents/Resources/etc/e/eterm-color.ti anymore :( Jun 5, 2013 at 18:14
  • 1
    Where can the .terminfo file be found? If you are using a Mac as well, then where did you get it from?
    – emish
    Sep 23, 2013 at 23:51
  • 3
    I still had to do terminfo setting with the latest Homebrew Emacs. I've used tic -o ~/.terminfo /usr/local/Cellar/emacs/24.3/share/emacs/24.3/etc/e/eterm-color.ti Sep 3, 2014 at 9:11
9

I needed to set the following environment variables in my ~/.zshrc

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export TERM=xterm-256color
0
1

This installed eterm-color.ti for me on OSX Mavericks 10.9.5:

  1. Upload eterm-color.ti to /tmp on the remote OSX server.

  2. Run the command sudo tic -o /usr/share/terminfo /tmp/eterm-color.ti on the server.

In my case, this put a file eterm-color in the directory /usr/share/terminfo/65/

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.