2

I'm using iterm2 together with tmux and I need the function keys. Ever since I got the TouchBar Macbook Pro and upgraded to HighSierra, the F4 key became disfunctional in iTerm2 and emacs.

  • The F4 key is used to cycle through the open tabs in tmux forwards
  • The F3 key (cycle backwards) and in fact all other F keys work as expected
  • The F4 key worked before the HighSierra / Touchbar upgrade. I used Time Machine to migrate, so no configuration changed.
  • The F4 also does not work with on an external Magic Keyboard, indicating a software / mapping issue.

I suspect that some change in High Sierra makes macOS not pass the F4 key on to applications, but I'm not sure. I have checked that no system wide keyboard shortcut is assigned to F4. What else could I check?

Update: The issue can be confirmed with the keyboard viewer, a program that allows to display all keys pressed. It clearly confirms that all keys except F4 are registered by the system while F4 is not.

4 Answers 4

1

I have seen elsewhere that some key combos stop working until you reinstall iTerm2. If you have homebrew and cask installed, you can use brew cask reinstall iterm2.

(I'm so unsure about the efficacy of this that I would have posted it as a comment, but I can't comment yet)

3
  • turns out it does not depend on iterm2. It also happens in emacs.
    – Thomas
    Commented Dec 4, 2017 at 9:05
  • How about in native Terminal.app? (Hey, I can comment on my own answer!) Commented Dec 5, 2017 at 9:26
  • It was system wide. The F4 key did not register anywhere. I confirmed it using "keyboard viewer" as described in the question and solved it as in my answer.
    – Thomas
    Commented Dec 5, 2017 at 9:55
0

I found a (weird) solution here. This could be some arcane migration bug that is present in MacOS for very long time. The linked thread is from 2011. Here is what worked for me.

  1. Backup your keyboard shortcut preferences (i.e. write them down)
  2. Delete the file ~/Library/Preferences/com.apple.symbolichotkeys.plist
  3. reboot
  4. Set up keyboard shortcuts in preferences as desired
1
  • Not work for me... at least, with this reset I got all new shortcut from sierra... work with <fn> + <cmd> + <f4>
    – heralight
    Commented Mar 4, 2018 at 6:04
0

Apparently it's related to safari and / or chrome, and / or gmail / inbox https://discussions.apple.com/thread/7813416

a quick fix: +Q on safari and chrome, wait 30-40s, test it...

0

I discovered the issue to be the Spotify app. Just add this to the stack of grievances with their app/service and lack of support.

I still have Chrome open now, and about 30 seconds after quitting Spotify, F4 is working just fine again.

I just went a step further and found a solution! I diffed the running processes listed in Activity Monitor both before and after running Spotify, and one process stood out: NowPlayingTouchUI. I did a force quit on that process in Activity Monitor, and F4 works again! However, as soon as the song changes, it comes back.

From some other info I found online, I devised the following solution which fixes the problem by preventing this process from running.

Disable SIP

  1. Restart the machine in recovery mode (cmd-R) on startup.
  2. Click on the Utilities menu and select "Terminal"; if you don't see this, you need to restart and enter Recovery Mode again.
  3. Type "csrutil disable" in Terminal, then press enter.
  4. Close Terminal and select "Restart" from the Apple menu.

Move the NowPlayinTouchUI LaunchAgent

  1. After the system restarts, run Terminal again, and enter the following command, and press enter, and type in your password (if/when prompted) and hit enter again. This command will move the com.apple.NowPlayingTouchUI.plist file from the LaunchAgents folder to your home directory.

    sudo mv /System/Library/LaunchAgents/com.apple.NowPlayingTouchUI.plist ~
    
  2. Lastly, just logout/login again for the changes to take effect.

From this point on, NowPlayingTouchUI will no longer be launched, and your F4 key will continue working while using the Spotify app!

If you wish to re-enable SIP, just relaunch in recovery mode again, launch terminal, and enter the command "csrutil enable" and press enter, then restart.

This fix is confirmed working after a couple restarts of my MacBook Pro (macOS 10.12.6 Sierra) and Spotify (1.1.52.687.gf5565fe5).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .