Set Terminal Focus to Follow the Mouse Cursor in Mac OS X
If you’re coming to Mac OS X from elsewhere in the unix & x11 world, you might be used to the focus of Terminal windows following your mouse cursor. With a little command line magic, we can enable this hidden feature in the Mac OS X Terminal.app too.
This requires the usage of a defaults write string, the syntax is slightly different depending on the version of OS X that is running on the Mac, but it’s supported in virtually every version of the Mac operating system that has the Terminal application.
Enable Mouse Focus for Terminal in Mac OS X Yosemite & Mavericks
Launch the Terminal and enter the following defaults write string:
defaults write com.apple.Terminal FocusFollowsMouse -string YES
You’ll then need to relaunch the Terminal app for the change to take effect.
To disable focus following the cursor, use the following string in modern versions of OS X:
defaults write com.apple.Terminal FocusFollowsMouse -string NO
Again, relaunching the Terminal for changes to take effect.
If you look carefully, you’ll notice the command for Terminal mouse focus in OS X Yosemite is nearly identical to prior versions, except you use a capitalized “T” in “com.apple.Terminal”.
Enable “Focus Follows Mouse” in Terminal for Prior Versions of OS X
Older versions of OS X, like Mountain Lion and Snow Leopard, can use the following terminal command string to enable mouse focus:
defaults write com.apple.terminal FocusFollowsMouse -string YES
You’ll now need to relaunch Terminal.app for changes to take effect.
If you don’t like it, you can disable cursor focus by changing YES to NO and reissuing the command:
defaults write com.apple.terminal FocusFollowsMouse -string NO
Then relaunch Terminal.app for the click-to-focus default setting to be enabled again.
Finally, If you’re wondering what my super awesome background picture is, it’s the 8-bit pixelated aurora wallpaper.
Long time developer using Unix/Linux. Now working in a pure Mac shop (thank god, not Windows.)
Best things lost were unix cli, mouse follows focus, and select copies text + middle click paste.
Wish it was across all windows, ah, well…
Both are now there at least in Terminal. And just hooray the underlying OS is unix :) !!
Too bad it can’t be done for all windows.
Shame this command doesn’t work for all windows and apps. Also would be great if there was another command line to bring a window to the top.
You can use Command+1 Command+2 Command + 3 etc to bring specific windows to the top and be active, just remember which is which and you’ll be able t switch them easy
doesn’t work in yosemite
Terminal mouse focusing does work in OS X Yosemite. Follow the instructions listed here under the Yosemite section to get the “Focus Follows Cursor” trick to work in OS X Yosemite. https://osxdaily.com/2011/04/18/terminal-focus-follow-mouse-mac/
Worked for me. I only wonder why this isn’t default behavior. Seems to be only a good thing.
[…] osxdaily.com This entry was posted in Tweaks on my mac and tagged mac, terminal.app, tweak by […]
This does bring the window to focus on OS X (10.7) as well. Is there a way to bring focus to the window, and then make it the top window, because right now this tweak just makes window focus, but does not make it the top window. I figure there is a another simple line to make the window the top window. BTW great tweak :D
Hmmm…. not exactly what I was hoping for…. what I thought this meant was that if I entered a directory in finder that Terminal would choose the same directory. So, what does “focus” in this case mean? I don’t see any difference.
It doesn’t effect PWD, only that the focus of windows follows your mouse cursor. Think old school X11 window managers.
X11 style, great idea