How to get better experience in Terminal with VoiceOver

By Manuel, 19 November, 2024

Forum
macOS and Mac Apps

Many people have difficulties using Terminal on macOS with VoiceOver. Especially navigation on outputs in the Terminal app can be a bit tricky. Fortunately, there is a solution that makes it a lot smoother to navigate the output without interacting, stopping interaction, clearing the window etc.

The solution is Tmux, a tool which is primarily used to work with multiple Shell sessions and a lot of other stuff. However, it has a mode similar to a pager where you can navigate the output using arrow keys. Interacting all the time is a thing of the past with this tool.

First, you have to install Tmux. You can do this using Homebrew by typing:

brew install tmux

and then confirm with return. After the tool has been installed, enter:

tmux

Tmux has been started and the fun can begin. Type in ls -1, for example, in a big directory to get a lot of output. Then, press CTRL plus b followed by page up to enter the pager mode (I don't know if it's called such, I've not looked up the right term). Then, you can start navigation using up and down arrows, like if you were in a document in a text editor. Once you're done, press q to exit that mode. If you need it again, press CTRL plus b followed by Page Up and navigate around the output again.

Tmux can do a lot more things like multiple windows in a terminal that can be changed easily. If you are interested, you can look up the documentation, the tool is such a power house.

I hope that this helps a lot of people working with Terminal on the Mac. If you have further questions, feel free to ask.

Options

Comments

By mr grieves on Monday, December 16, 2024 - 17:16

I just had a play with this. Although I'm not sure if Ctrl+B, then Page Up is a lot easier than using VO to interact, one thing I do like about this is that I can be going up and down lines in terminal, then move to a different application, then move back to terminal and it seems to be in the same place. So if I am wanting to refer back to where I was then this is a big improvement on the default behaviour.

Is it possible to select multiple lines to copy from the terminal? With VO I can use VO+Enter to select lines, so would be handy if there was an equivalent with this.

I had a quick look at the docs but it's a bit overwhelming. I will try to have more of a play with it when I am using terminal for real next week.

Thanks for sharing - I had never heard of this before.

By João Santos on Thursday, January 23, 2025 - 17:16

The problem with nested terminal emulation is that suddenly the scroll buffer of the native outer Terminal becomes irrelevant, so selecting anything longer than a single terminal window for copying elsewhere becomes impossible, and the inner terminal emulator like screen or tmux doesn't have access to the window server's clipboard so it can't fully replace that functionality of the native Terminal. I run into this problem often when I use a nested terminal instead of a simple cat to read serial output. from embedded or bare metal code.

Another problem with terminals in general, is that the caret is positioned at the bottom of the output by default, as that's where the next command-prompt appears, but in some cases, like when reading compiler errors, it's best to start from the top, which is why I recommend piping output to an editor like TextMate. For example Rust's compiler errors and warnings tend to be quite long vertically speaking, so having to move the caret all the way back to the top to read the most relevant error quickly becomes an annoyance. One thing that could help and I haven't explored yet would be some kind of functionality to save the current scroll buffer caret position at the command-prompt before entering the output-producing command, in order to recall that position later and avoid having to manually reposition the caret. However since piping output to TextMate completely addresses this problem for me, I haven't spent time investigating anything else.

I have considered either making a native screen-reader dedicated to Apple's terminal alone, which would be a project with a much smaller scope than Vosh, or making a dumb terminal emulator to make navigating output from shell commands easier. However my current occupation, which might end up benefiting us as well, and was a byproduct of my work on Vosh back in 2023, consumes all my waking time, so I can't really think of personal projects or hobbies right now.