Why don't the keyboard shortcuts to switch Terminal tabs work anymore?

I just got a new Mac with macOS Ventura. I use Terminal often, and several tabs in it. Why doesn't the keyboard shortcut for switching tabs work anymore?


I understand that, for some reason, it changed from command-1 (or command-2, or command-3, or so) to option-command-1 (-2, -3, etc). But they don't. Or, they'll work for a short while, and then stop --- sometimes for one particular tab, sometimes for several tabs, sometimes for all of them --- and nothing but quitting and restarting Terminal will bring it back.


Under Terminal/Settings/General I have checked, turned on, the 'Use command-1 through command-9 [sic] to switch tabs' option, which has no effect on this behavior.


What is broken here and how long has Apple been refusing to fix it?

MacBook Pro 15″, macOS 10.12

Posted on Jul 8, 2023 9:58 PM

Reply
Question marked as Top-ranking reply

Posted on Jul 15, 2023 8:46 AM

I cannot reproduce your situation (Ventura 13.4.1 (c) ). I Launch macOS Terminal. I create several new tabs. I hide macOS Terminal. I switch to other apps. I unhide macOS Terminal. Command-1, Command-2, etc... all works. I even tried creating a 2nd window with several tabs, and repeated the hide, play around, unhide, Command-1, Command-2, ... test in both windows, and it still worked as expected.


  • The shell will not affect the GUI parts of macOS Terminal.


  • The TERM=xterm-256color vs TERM=vt102 will not affect the GUI parts of macOS Terminal. All that this setting does is tell the programs you run how to move the cursor around and how many colors they are allowed to use. macOS Terminal always supports all the colors it is going to support, and if you select a TERM setting with less colors, you can still send the escape sequences to generate more colors. If you specify a less capable terminal type, such as vt100, you can still send macOS Terminal escape sequences for more advanced terminal types. And generally speaking, xterm-256color is the best choice so the programs you run will know they have a more advanced terminal emulator to work with.


Stupid Question? Do you use a 3rd party keyboard?


I use either my MacBook Pro keyboard, or a Apple USB extended keyboard, with and Apple Magic Trackpad on the side of it.


If you are using a 3rd party keyboard, that may be something to factor into the problem.


At work, I live in a terminal emulator. I happen to use iTerm2 (https://iterm2.com; free), but mostly because when it was Mac OS X 10.3, Terminal did not support tabbed windows, but iTerm did, plus iTerm had a few other features I found useful. Since the early 2000's Terminal has improved, and now includes many of the reasons I started using iTerm (and eventually iTerm2). But there are still a few iTerm2 features I am hooked on, so I stay with iTerm2.


iTerm2 also has the Command-1, Command-2, etc... tab switching feature as well.


I AM NOT suggesting you switch to iTerm2, I'm just pointing out there are alternatives.


I am going to suggest you experiment with iTerm2 to see if Command-1, Command-2, ... works correctly on your system. Because IF IT DOES NOT work correctly, then this would imply there is something interfering with both terminal emulators.


As I said, I live in terminal emulators, but I DO NOT use Command-1, Command-2, etc... I use a Magic Trackpad, and BetterTouchTool (https://folivora.ai; paid app) and I have mapped a 3-finger left and right swipe to move to the previous or next tab. I have also used BetterTouchTool to map Control-Page-Up and Control-Page-Down to move to the previous or next tab (I have an extended keyboard with Page-Up and Page-Down keys). This works for me. If I need to move to a specify tab, I use my mouse. I never got into the habit of Command-1, Command-2, ....


Would you be interested in posting the output from an EtreCheck run?

https://EtreCheck.com

Just the free version. You do not have to pay for any of the extras.


EtreCheck should show if you have any 3rd party additions that maybe you forgot about, or were unaware of.


Similar questions

16 replies
Question marked as Top-ranking reply

Jul 15, 2023 8:46 AM in response to Nebusj

I cannot reproduce your situation (Ventura 13.4.1 (c) ). I Launch macOS Terminal. I create several new tabs. I hide macOS Terminal. I switch to other apps. I unhide macOS Terminal. Command-1, Command-2, etc... all works. I even tried creating a 2nd window with several tabs, and repeated the hide, play around, unhide, Command-1, Command-2, ... test in both windows, and it still worked as expected.


  • The shell will not affect the GUI parts of macOS Terminal.


  • The TERM=xterm-256color vs TERM=vt102 will not affect the GUI parts of macOS Terminal. All that this setting does is tell the programs you run how to move the cursor around and how many colors they are allowed to use. macOS Terminal always supports all the colors it is going to support, and if you select a TERM setting with less colors, you can still send the escape sequences to generate more colors. If you specify a less capable terminal type, such as vt100, you can still send macOS Terminal escape sequences for more advanced terminal types. And generally speaking, xterm-256color is the best choice so the programs you run will know they have a more advanced terminal emulator to work with.


Stupid Question? Do you use a 3rd party keyboard?


I use either my MacBook Pro keyboard, or a Apple USB extended keyboard, with and Apple Magic Trackpad on the side of it.


If you are using a 3rd party keyboard, that may be something to factor into the problem.


At work, I live in a terminal emulator. I happen to use iTerm2 (https://iterm2.com; free), but mostly because when it was Mac OS X 10.3, Terminal did not support tabbed windows, but iTerm did, plus iTerm had a few other features I found useful. Since the early 2000's Terminal has improved, and now includes many of the reasons I started using iTerm (and eventually iTerm2). But there are still a few iTerm2 features I am hooked on, so I stay with iTerm2.


iTerm2 also has the Command-1, Command-2, etc... tab switching feature as well.


I AM NOT suggesting you switch to iTerm2, I'm just pointing out there are alternatives.


I am going to suggest you experiment with iTerm2 to see if Command-1, Command-2, ... works correctly on your system. Because IF IT DOES NOT work correctly, then this would imply there is something interfering with both terminal emulators.


As I said, I live in terminal emulators, but I DO NOT use Command-1, Command-2, etc... I use a Magic Trackpad, and BetterTouchTool (https://folivora.ai; paid app) and I have mapped a 3-finger left and right swipe to move to the previous or next tab. I have also used BetterTouchTool to map Control-Page-Up and Control-Page-Down to move to the previous or next tab (I have an extended keyboard with Page-Up and Page-Down keys). This works for me. If I need to move to a specify tab, I use my mouse. I never got into the habit of Command-1, Command-2, ....


Would you be interested in posting the output from an EtreCheck run?

https://EtreCheck.com

Just the free version. You do not have to pay for any of the extras.


EtreCheck should show if you have any 3rd party additions that maybe you forgot about, or were unaware of.


Mar 4, 2024 11:50 AM in response to dialabrain

I've been able to repeat this issue on Sonoma 14.3.1, and it is very annoying. Use these steps to recreate:


  1. Start with a plain terminal (I deleted ~/Library/Preferences/com.apple.Terminal.plist)
  2. Add new windows (I just used Cmd-N), add at least 3 (for a total of 4)
  3. Use keyboard shortcut Cmd-Opt-1, Cmd-Opt-2, Cmd-Opt-3, Cmd-Opt-4. That should switch between each terminal window.
  4. Hide the Terminal App (Cmd-H)
  5. Got to any other app (Safari, Notes, etc.)
  6. Go back to Terminal
  7. Try redoing step #3, and it will not work


I think this is a bug that has existed since Sonoma, does anyone have a fix?

Jul 14, 2023 9:47 PM in response to dialabrain

This was a good thought too, but it still doesn't work. Even in Safe Mode, and even with the .plist deleted and restarted, once a Terminal tab is hidden its command-numeral key stops working.


I realized I was still using the old shell, and switched to the contemporary one, but that also doesn't make a difference. Nor does changing the terminal type from xterm-256color to something else like vt102.


Weirdly, un-clicking the checkbox for 'Use command-1 through command-9 to switch tabs' allowed me to *start* using command-1 through command-9 to switch tabs, at least until the first case of hiding a tab. Before that I'd had to use option-command-numeral instead.


This is all bizarre. Normally it's my spouse who has the weird cursed computer problem that nobody else in the world has even imagined happening and that's beyond everyone's ability to diagnose.

Mar 4, 2024 12:16 PM in response to newtreen

When you hide an app, you no longer have pointer or keyboard focus on it until you click on its Dock icon and restore those properties as it reopens. I just hid my Terminal app, clicked on Safari, then clicked on the Terminal app in the Dock to relaunch it and all of my keyboard shortcuts continued to work including jumping from tab 1 to tab 9 using cmd+9.

Mar 4, 2024 12:17 PM in response to VikingOSX

It was the act of hiding it, going to another app, then coming back to Terminal (with all the Terminal windows showing again), that led to the Cmd-Opt-# keys no longer allowing me to swap between terminal windows (steps 6 and 7 of my procedure to recreate the problem).


It sounds like you're able to confirm that you did all the steps of my procedure and were able to do #7 again with no issues? I.e., the Cmd-Opt-# shortcut to swap between specific windows still worked for you after hiding the Terminal app and then reactivating it again?

Jul 9, 2023 5:35 PM in response to BobHarris

I appreciate this --- and every --- suggestion about trying it in Safe Mode; I admit, I didn't think to try that.


Unfortunately, it doesn't make a difference. The problem happens there too. What seems to be the moment causing it is when I hide Terminal (command-H), go to something else, and then bring Terminal back later.


There are --- there should be --- no extensions on this; it never even crossed my mind that Terminal could have extensions. The other keyboard shortcuts all work, including 'cycle through windows' (command-`). But command-1, or option-command-1? Dead, just dead.

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.

Why don't the keyboard shortcuts to switch Terminal tabs work anymore?

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