Configure terminal escape sequence

OS: 13.2 (22D49)


I'm trying to run this embedded example and run into the issue with an `escape sequence` I think:

Your terminal application does not support escape sequences.


Line editing and history features are disabled.


On Windows, try using Putty instead.


When I go to the `Terminal settings` I see an `Escape Sequence` text that pops up a message:


Programs notify Terminal of the current working directory by sending it commands. You may need to configure your shell or other programs to enable this behavior.

The working directory may be set using the Operating System Command (OSC) escape sequence:

	ESC ] Ps ; Pt BEL

The parameter Ps is 7 (working directory) and Pt is a “file:” URL. The URL should include a hostname to disambiguate local and remote paths, and characters must be percent-encoded as appropriate.


Can someone help with how to setup an escape sequence for the terminal? I tried running the command in the terminal but get no response:


MacBook-Pro basic % ESC ]7;test BEL
zsh: command not found: ESC
MacBook-Pro basic % ESC]7;test BEL
zsh: command not found: ESC]7



MacBook Pro 16″

Posted on Feb 8, 2023 9:55 PM

Reply
Question marked as Top-ranking reply

Posted on Feb 9, 2023 9:23 AM

Apple Terminal.app is a quite-compatible terminal emulator and supports common escape and control sequences just fine and has for aeons, and is largely Digital Equipment Corporation (DEC) VT terminal and ANSI compatible when using older terminology, and is ECMA-35 and ECMA-38 compatible when using newer terminology.


The following zsh example command shows two escape sequences (using \e[ as the control sequence introducer, with \e being the escape control character, also known as \033), the first sequence (\e[95;1m) setting color and bold and the second (\e[0m) reverting it, with some text to render colored and bold between the two, and all that then followed by a pair of bell (BEL) characters (control characters) using two different zsh notations for that bell control character (\a and \007), and a newline character (\n) to finish out the line:


printf "\e[95;1mHello, World\e[0m\a\007\n"


Different shells and different programming languages have different syntax for control sequences and control characters. zsh uses \e for escape and \a for bell, for instance. But this Terminal.app DEC VT / ANSI / ECMA terminal emulation stuff is in endemic use across macOS command-line apps and add-on apps and tools, and it works.


Which is a lot of words indicate that there seems some other issue with your app’s terminal detection malfunctioning here, or probably more likely a setup step is missing here, and you will want to check with the maintainers about this.


PS: Everything you want to know about classic escape and control handling is available in the manuals at the https://vt100.net website. While Terminal.app doesn’t support all of a late-stage DEC VT terminal or probably all of ANSI terminal capabilities, it supports all of the commob stuff and is more than enough for most tasks.

3 replies
Question marked as Top-ranking reply

Feb 9, 2023 9:23 AM in response to wordtobird232

Apple Terminal.app is a quite-compatible terminal emulator and supports common escape and control sequences just fine and has for aeons, and is largely Digital Equipment Corporation (DEC) VT terminal and ANSI compatible when using older terminology, and is ECMA-35 and ECMA-38 compatible when using newer terminology.


The following zsh example command shows two escape sequences (using \e[ as the control sequence introducer, with \e being the escape control character, also known as \033), the first sequence (\e[95;1m) setting color and bold and the second (\e[0m) reverting it, with some text to render colored and bold between the two, and all that then followed by a pair of bell (BEL) characters (control characters) using two different zsh notations for that bell control character (\a and \007), and a newline character (\n) to finish out the line:


printf "\e[95;1mHello, World\e[0m\a\007\n"


Different shells and different programming languages have different syntax for control sequences and control characters. zsh uses \e for escape and \a for bell, for instance. But this Terminal.app DEC VT / ANSI / ECMA terminal emulation stuff is in endemic use across macOS command-line apps and add-on apps and tools, and it works.


Which is a lot of words indicate that there seems some other issue with your app’s terminal detection malfunctioning here, or probably more likely a setup step is missing here, and you will want to check with the maintainers about this.


PS: Everything you want to know about classic escape and control handling is available in the manuals at the https://vt100.net website. While Terminal.app doesn’t support all of a late-stage DEC VT terminal or probably all of ANSI terminal capabilities, it supports all of the commob stuff and is more than enough for most tasks.

Feb 9, 2023 1:59 PM in response to wordtobird232

NOTE: When using command line utilities (such as vim or emacs) that like to send escape sequences, it is best to set your TERM environment variable to something like:


export TERM=xterm-256color


This will give the programs a rich color environment.


the 'tput' command can return various terminal emulator escape sequences. Google 'tput' and you will find examples.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Configure terminal escape sequence

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.