Ask Different (Apple)
Q&A for power users of Apple hardware and software
Latest Questions
0
votes
1
answers
50
views
is it possible to hide panes and unide them later in iterm2?
My ideal workflow is 4-5 panes in one window. At any given time I might only want 1-2 open. Up until now i've just been focusing on a pane. Is there anyway where I can focus on 2 panes at once instead? or alternatively, to hide the panes i'm not using and unhide them later
My ideal workflow is 4-5 panes in one window.
At any given time I might only want 1-2 open. Up until now i've just been focusing on a pane. Is there anyway where I can focus on 2 panes at once instead? or alternatively, to hide the panes i'm not using and unhide them later
sf8193
(101 rep)
Jun 22, 2025, 07:15 PM
• Last activity: Jul 23, 2025, 12:04 AM
0
votes
1
answers
66
views
iTerm dropdown window opens in a different Space
I’m experiencing an issue with iTerm2’s dropdown window: Sometimes, after extended use when triggered via hotkey, it causes a Space switch, opening in a different Space instead of the current one. The window functions correctly, but it can’t be accessed from any other active Space except for that on...
I’m experiencing an issue with iTerm2’s dropdown window: Sometimes, after extended use when triggered via hotkey, it causes a Space switch, opening in a different Space instead of the current one. The window functions correctly, but it can’t be accessed from any other active Space except for that one. The Space of the window seems to be random -- I’ve been unable to discern the logic behind its choice.
The issue temporarily resolves by closing the dropdown window (closing all tabs) and reopening it, but it recurs intermittently—typically after the system wakes from sleep.
I’ve reviewed and tried the suggestions from the following threads:
• https://apple.stackexchange.com/questions/276139/iterm2-keeps-switching-desktops-using-dropdown
• https://apple.stackexchange.com/questions/85890/open-iterm-drop-down-console-on-different-screen
I’ve also tested various combinations of Style, Screen, and Space under Preferences > Profiles > Window, without success.
I’m on the latest iTerm2 version and macOS, and this issue has persisted across versions.
I hope to find a solution to the problem, or a way to disable it without having to close the window.
Kolja
(726 rep)
Apr 4, 2025, 07:52 AM
• Last activity: Jul 20, 2025, 05:06 PM
0
votes
1
answers
41
views
Key bindings Option+Delete not working as expected in iTerm2
On my previous MacBook I had a keybinding in iTerm2 which would delete a word when I press Option + Delete. Unfortunately I don't have access to my previous MacBook any more to see how it was done. When I have a string like `something` and the cursor is at the end it would delete the whole word (exp...
On my previous MacBook I had a keybinding in iTerm2 which would delete a word when I press Option + Delete. Unfortunately I don't have access to my previous MacBook any more to see how it was done.
When I have a string like
something
and the cursor is at the end it would delete the whole word (expected behavior).
When the string is /etc/nginx/nginx.conf
it would delete nginx.conf
leaving only /etc/nginx/
(which is also expected).
Unfortunately the best thing that gets even close to this behavior is adding a custom binding in iTerm2 to send Option + Delete
and send Hex key 0x17
. This will however always delete the whole string /etc/nginx/nginx.conf
and not just nginx.conf
from it.
I tried many conbinations with .inputrc
, which at the end I couldn't make work, but even if I did it would have worked only in the local shell. Logging in to a remote server via SSH would still have the same behavior (delete the whole word).
The behavior I am describing works well without any additional settings in Notes
where slashes seem to be a word separator.
When I navigate to General -> Selection I removed the / from the Characters considered part of a word
but this didn't change anything.
Atanas Stoyanov
(3 rep)
Jul 11, 2025, 09:57 AM
• Last activity: Jul 11, 2025, 02:07 PM
2
votes
2
answers
76
views
How to get new VS Code windows to have text input focus?
I am using Visual Studio Code on my macbook. When I launch a new instance of VS Code when I already have 1 instance up, via `code` using iTerm, the *already running* instance is the one that has text input focus. This means when the new VS Code instance pops up, I can't immediately start typing in i...
I am using Visual Studio Code on my macbook. When I launch a new instance of VS Code when I already have 1 instance up, via
code
using iTerm, the *already running* instance is the one that has text input focus. This means when the new VS Code instance pops up, I can't immediately start typing in it; I have to click it with my mouse first, *then* I can type.
What I want is for the new instance of VS Code to have text input focus. Is this a MacOS specific setting, something I need to configure in VS Code, or an adjustment in how I launch VS Code from the command line?
Some contextual information:
- MacOS Version: 15.3.1
- In "Desktop & Dock" settings for Mission Control, I have "Automatically rearrange Spaces based on most recent use" disabled, and "Displays have separate spaces" enabled.
- I have 2 external monitors connected and am also using the macbook display (for 3 total).
- The current instance of VS Code is on my middle display, and the new instance pops up on my right display.
- For testing I'm running code
directly in iTerm, but the real use case is when VS Code is launched from git, such as when I do git commit
, because I have Code set up as my git editor with setting core.editor
set to code --wait --new-window
.
void.pointer
(121 rep)
Feb 17, 2025, 06:43 PM
• Last activity: Jun 23, 2025, 10:30 PM
0
votes
1
answers
51
views
iTerm2 opens tab with different profile than the default
I have a specific profile set as my default in iTerm2. For some weird reason, when I open a new tab using the `Shell > New Tab` menu item, iTerm2 opens the tab with the correct profile. I get the same profile when I open a new window. When you open the Shell menue and look at the New Tab entry in it...
I have a specific profile set as my default in iTerm2. For some weird reason, when I open a new tab using the
Shell > New Tab
menu item, iTerm2 opens the tab with the correct profile. I get the same profile when I open a new window. When you open the Shell menue and look at the New Tab entry in it, does it display ⌘ T
But when I use the keyboard shortcut ⌘ T
, it opens using a different profile.
I've checked my macOS system keyboard shortcuts, and there's nothing for this shortcut in there.
I'm on macOS Sequoia and zsh.
And Finally
(153 rep)
May 13, 2025, 11:05 AM
• Last activity: May 26, 2025, 11:13 AM
2
votes
1
answers
295
views
Can I pass environment variables like PWD to an iterm trigger?
For instance, given the below trigger: [![Trigger][1]][1] When I double click the captured output, it runs the script: `~/rerun_test.sh` supplying the filename that was matched: `\1`. However, the application I work with does not output the present working directory (PWD) so I need to have it availa...
For instance, given the below trigger:
When I double click the captured output, it runs the script:

~/rerun_test.sh
supplying the filename that was matched: \1
.
However, the application I work with does not output the present working directory (PWD) so I need to have it available to me as a variable that I can supply somehow or the other.
For semantic history when you run a command the PWD is \5
for instance:
> Command runs when you activate Semantic History on any filename. Use \1 for filename, \2 for line number, \3 for text before click, \4 for text after click, \5 for pwd. You can also use interpolated string syntax.
Obviously in this context: ~/rerun_test.sh \1 \5
does not work.
How do you supply PWD
to a coprocess
script?
Kevin Johnson
(121 rep)
May 7, 2020, 11:00 AM
• Last activity: May 19, 2025, 01:04 AM
1
votes
2
answers
1827
views
iTerm2 shell integration isn't working
I am using iTerm2 3.0.15 beta on Sierra. I have had shell integration installed since many months ago. At some point, shell integration stopped working. (I'm not very observant; I just noticed it at some point. I'd been away for a while, too.) What I mean when I say it stopped working is that comman...
I am using iTerm2 3.0.15 beta on Sierra. I have had shell integration installed since many months ago. At some point, shell integration stopped working. (I'm not very observant; I just noticed it at some point. I'd been away for a while, too.) What I mean when I say it stopped working is that command history, recent directories, etc. sections of the Toolbelt are empty. Also, there are no mark indicators before the bash prompt.
I've been looking for a solution off and on for some weeks. I've tried manually sourcing $HOME/.iterm2_shell_integration.bash to make sure it was sourced and that it wasn't getting clobbered by something else in my setup. Just today, I upgraded to 3.1.6 beta 2, but shell integration is still not working.
Nothing has worked and I'm at a loss for where else to look for problems.
76 Pinto
(11 rep)
Feb 8, 2018, 01:03 AM
• Last activity: May 8, 2025, 12:54 PM
4
votes
1
answers
1498
views
How to select text with mouse cursor in iTerm 2?
I want to select text in iTerm just like I can in Powershell: with mouse cursor. By holding LMB and selecting it and then - pressing backspace to delete everything I selected - entering any character or pasting to replace selected - copying it with command+c I tried shift+left arrow and shift+right...
I want to select text in iTerm just like I can in Powershell: with mouse cursor. By holding LMB and selecting it and then
- pressing backspace to delete everything I selected
- entering any character or pasting to replace selected
- copying it with command+c
I tried shift+left arrow and shift+right arrow combinations but no luck
This is my preferences (where "natural selection" must be):


hloth
(203 rep)
Aug 20, 2022, 06:58 PM
• Last activity: May 2, 2025, 12:03 AM
1
votes
1
answers
120
views
iterm2 profile environment
Iterm2 profiles have the general option to specify a command to run in the profile, such as ssh. What environment does this command run in? It doesn't seem to be the environment of the default shell.
Iterm2 profiles have the general option to specify a command to run in the profile, such as ssh. What environment does this command run in? It doesn't seem to be the environment of the default shell.
Evan Fishbein
(11 rep)
Mar 26, 2024, 05:00 PM
• Last activity: Apr 22, 2025, 08:00 AM
1
votes
1
answers
225
views
Go back/forward one word keybinding does not work in Nano 8.2
I'm using GNU Nano 8.2 in ZSH on macOS Sonoma and I'm trying to figure out why the standard keybinding to move the cursor back or forward one word, `^ + arrow keys`, doesn't work. This happens both in the default Terminal app and iTerm2. I'm using a French physical keyboard but I've tried setting it...
I'm using GNU Nano 8.2 in ZSH on macOS Sonoma and I'm trying to figure out why the standard keybinding to move the cursor back or forward one word,
^ + arrow keys
, doesn't work.
This happens both in the default Terminal app and iTerm2. I'm using a French physical keyboard but I've tried setting it both to French and US keyboard.
Thanks
Ludon89
(11 rep)
Nov 16, 2024, 08:56 PM
• Last activity: Apr 16, 2025, 10:00 PM
0
votes
0
answers
82
views
How can I uninstall the plugin extension from the iRightMouse tool?
I installed the app irightmouse from [this website](https://www.irightmouse.com/) or [this App Store link](https://apps.apple.com/cn/app/%E8%B6%85%E7%BA%A7%E5%8F%B3%E9%94%AE-irightmouse/id1497428978?mt=12&pt=119219825&ct=Better365), and it had instructions to run this command upon installation ``` p...
I installed the app irightmouse from [this website](https://www.irightmouse.com/) or [this App Store link](https://apps.apple.com/cn/app/%E8%B6%85%E7%BA%A7%E5%8F%B3%E9%94%AE-irightmouse/id1497428978?mt=12&pt=119219825&ct=Better365) , and it had instructions to run this command upon installation
pluginkit -e "use" -i cn.better365.iRightMouse.iRightMouseExtension;killall Finder
The app ended up not working, and then I noticed that every time I double click my right mouse button that it closed the window I'm working in, there is no instructions on the site on how to undo the command so I'm stuck. is there anyway to reverse the command or remove it?
Eddie Davis
(11 rep)
Mar 17, 2025, 09:03 AM
• Last activity: Mar 17, 2025, 10:14 AM
0
votes
0
answers
105
views
How can I keep the session name fixed in iterm2 tab created by applescript?
I have been using iterm2 and I created an `applescript` to automate the process of opening some tabs I need to work in my project. I opens a few tabs, moves to directories, run a few statements (`git pull`, `npm install`, etc..) and set the session name (tab name). See the example: ``` #!/usr/bin/os...
I have been using iterm2 and I created an
If I click on it, it switches to locked, which provides the behaviour I want, by prefixing the session name in the tab title.
**Question**: How can I set this lock via applescript?
Thank you!
applescript
to automate the process of opening some tabs I need to work in my project. I opens a few tabs, moves to directories, run a few statements (git pull
, npm install
, etc..) and set the session name (tab name). See the example:
#!/usr/bin/osascript
tell application "iTerm2"
tell current window
create tab with default profile
set backendTab to current session
end tell
tell backendTab
write text "cd /Users/felipe/projects/backend && git pull && npm install"
write text "clear"
set name to "backend"
end tell
end tell
And I call it from a function in my ~/.zshrc
function dev() {
osascript dev.scpt
}
It works, but the problem is when I run any command in these tabs such as npm start
to run my app, it changes the tab name. If I right click on the tab, I can see the session name set, and a unlocked icon next to it:


Felipe Oriani
(101 rep)
Feb 26, 2025, 07:43 PM
• Last activity: Feb 27, 2025, 10:34 AM
11
votes
4
answers
4149
views
No route to host on iterm2 only
For some unexplained reason, iterm2 cannot connect to (at least some) devices on my local host. I get: ``` ssh: connect to host 192.168.252.248 port 22: No route to host ``` Initially I thought this was related to SSH, but ping also doesn't work: ``` ping 192.168.252.248 PING 192.168.252.248 (192.16...
For some unexplained reason, iterm2 cannot connect to (at least some) devices on my local host. I get:
ssh: connect to host 192.168.252.248 port 22: No route to host
Initially I thought this was related to SSH, but ping also doesn't work:
ping 192.168.252.248
PING 192.168.252.248 (192.168.252.248): 56 data bytes
ping: sendto: No route to host
Request timeout for icmp_seq 0
On the built-in terminal this works as expected and the browser can also connect to the device's (.248) web inteface.
The first suspect that I thought of was little snitch, but there are clearly no rules that block the traffic from iterm2. I've also turned off the network filter just to make sure it isn't related to that, to no avail. It's true that this isn't the same as uninstalling, but I doubt little snitch is the culprit here.
Of course there scope link route to 192.168.252.0/24:
192.168.252.0/24 dev en0 scope link
Although this couldn't have been the problem, given that it works from other applications.
I don't have other issues that I know of on iterm2 related to connectivity, I can connect to any other hosts without any issues, including my router's web interface.
Any ideas what iterm2 might have changed or what settings I could change that could affect this?
I'm using Mac OS Sequoia 15.0.1 and iterm2 3.5.5.
I've also uninstalled little snitch completely just to make sure this isn't interefering, but it didn't make any difference.
Lethargos
(223 rep)
Oct 12, 2024, 07:32 AM
• Last activity: Feb 24, 2025, 04:18 AM
2
votes
1
answers
131
views
Cmd-clicking on the names of sh/md files in iTerm2 opens them in the browser (non-deterministically)
I am using macOS Sonoma 14.1.2 with iTerm2. I often search for files in the terminal, which then I would like to open by Cmd+clicking on their name. This should open them in the default text editor. However, I noticed that certain file formats, such as Markdown (`.md`) and Shell (`.sh`), are sometim...
I am using macOS Sonoma 14.1.2 with iTerm2. I often search for files in the terminal, which then I would like to open by Cmd+clicking on their name. This should open them in the default text editor.
However, I noticed that certain file formats, such as Markdown (
.md
) and Shell (.sh
), are sometimes picked up as URLs and are opened in my default brower. To reproduce, run:
cd /tmp
touch hello.md world.sh
echo hello.md world.sh
The when clicking on the printed hello.md
and world.sh
strings, the result is either opening the browser (to load https://hello.md/
or https://world.sh/
), or it is opening the respective files in the default text editor. The exact choice is non-determistic.
Is there a way to disable interpreting these filenames as URLs?
Gabor Szarnyas
(121 rep)
Dec 7, 2023, 12:59 PM
• Last activity: Feb 14, 2025, 04:21 PM
2
votes
1
answers
122
views
iterms2 sourcing bash even if zsh is default
I looks like my iterms terminal is sourcing bash before using zsh and it is doing it multiple times. I can't figure out why. On the left is the startup from my mac terminal and on the right from items [![enter image description here][1]][1] I have 1 profile on items that runs zsh [

RSale
(121 rep)
Aug 31, 2024, 02:42 PM
• Last activity: Feb 14, 2025, 03:02 PM
2
votes
2
answers
633
views
Why do iTerm2 / VSCode on MacOS Sequoia keep adding `com.apple.provenance` to my files?
I'm on MacOS 15.2. I've recently noticed that when I create a folder (or a file) in my home dir **with iTerm2** (thanks to *Linc Davis* for this hint), the attribute `com.apple.provenance` is added to it. E.g. (please note the tag @), $ mkdir foo $ ls -l drwxr-xr-x@ 2 myuser staff 64B Feb 4 23:01 fo...
I'm on MacOS 15.2. I've recently noticed that when I create a folder (or a file) in my home dir **with iTerm2** (thanks to *Linc Davis* for this hint), the attribute
com.apple.provenance
is added to it. E.g. (please note the tag @),
$ mkdir foo
$ ls -l
drwxr-xr-x@ 2 myuser staff 64B Feb 4 23:01 foo
$ xattr -l foo
com.apple.provenance:
The same happens for files:
$ touch bar
$ ls -l
-rw-r--r--@ 1 andrea staff 0B Feb 4 23:07 bar
$ xattr -l bar
com.apple.provenance:
I do not remember anything like this on MacOS 14.x. Why does it happen? This question explains how to remove the "@". However, I'd like to avoid the creation of this tag for every new folder/file. How can I do?
EDIT: the same happens for VSCode
floatingpurr
(575 rep)
Feb 4, 2025, 10:12 PM
• Last activity: Feb 5, 2025, 10:04 AM
57
votes
7
answers
49539
views
For iTerm2, how do I make the working directory appear in the window title?
I recently switched to iTerm2 from the default Terminal app and have a usability issue. On Terminal, the working directory you are in shows up on the title bar along with the process and pixel size. For example, when you click on Window to switch between different Terminal sessions, you'd see: worki...
I recently switched to iTerm2 from the default Terminal app and have a usability issue.
On Terminal, the working directory you are in shows up on the title bar along with the process and pixel size. For example, when you click on Window to switch between different Terminal sessions, you'd see: working_directory - process - pixel_size.
On iTerm2, unfortunately only the process shows in the title bar. So if I'm working in multiple iTerm2 windows on different directories, I can't easily differentiate which is which when I click on Window to choose one. I know I can easily switch between iTerm2 windows once I select one, but I'd like to identify exactly which window I want right away. (By the way, I use Witch, and Command-tabbing doesn't help either because here again only the process shows up on the list).
Any suggestions? I looked through all the preferences and didn't see anything. Creating profiles isn't exactly what I'm after--I'd just like to see the current working directory in iTerm2 window titles.
whiny_nil
(573 rep)
May 7, 2013, 09:48 PM
• Last activity: Jan 23, 2025, 11:37 AM
6
votes
3
answers
2348
views
iTerm2: Option + Number (0..9) key not working
I have a German keyboard layout and need e.g. Option+7 to write a pipe (`|`). Option+Letter (Letter=a..z) works fine, but Option+Number (Number=0..9) is not producing anything. However, if I press Option+n (`~`) and then Option+7, surprisingly I get `~|`. This behavior is only in iTerm2. The setting...
I have a German keyboard layout and need e.g. Option+7 to write a pipe (
|
). Option+Letter (Letter=a..z) works fine, but Option+Number (Number=0..9) is not producing anything. However, if I press Option+n (~
) and then Option+7, surprisingly I get ~|
. This behavior is only in iTerm2.
The setting in *Profiles >> Keys* is Left option key acts as Normal
and Right option key acts as Normal
.
Florian
(63 rep)
Aug 20, 2018, 07:30 AM
• Last activity: Jan 15, 2025, 03:54 PM
2
votes
1
answers
3302
views
how to let `clear` command just clears the current screen
I use iTerm2 apps as my terminal option on my Mac computers. On my 1st Mac, when I type `clear`, it just clears out the current screen, and when I scroll up, it could still show the previous contents on this tab which I really like. On my 2nd Mac, however, when I type `clear`, it clears everything o...
I use iTerm2 apps as my terminal option on my Mac computers.
On my 1st Mac, when I type
clear
, it just clears out the current screen, and when I scroll up, it could still show the previous contents on this tab which I really like.
On my 2nd Mac, however, when I type clear
, it clears everything out of this tab. When I try to scroll up, there's nothing’s present.
How can I make my 2nd Mac behave the same as my 1st one?
I've checked every single configuration in between these two machines for iTerm and they look identical, both are using oh-my-zsh.
Fisher Coder
(135 rep)
Apr 26, 2023, 05:22 PM
• Last activity: Jan 12, 2025, 08:26 AM
0
votes
0
answers
139
views
iTerm2 - open profile in a new window if different than current profile
I work extensively with tmux integration in iTerm2 and: 1. Open new profiles (typically connecting to a different tmux session) using shortcut keys 1. Open new windows or tabs within the same tmux session (same profile) using Cmd-w or Cmd-t 1. Use the hotkey window for most local terminal work If I...
I work extensively with tmux integration in iTerm2 and:
1. Open new profiles (typically connecting to a different tmux session) using shortcut keys
1. Open new windows or tabs within the same tmux session (same profile) using Cmd-w or Cmd-t
1. Use the hotkey window for most local terminal work
If I hit a shortcut key (for a tmux session profile) it always opens up in a tab of any already present iTerm2 window, which typically is the hotkey window, taking on the size of the hotkey window and not the window size defined in the profile. This becomes a "tmux session client" terminal which hides upon connection, but the whole tmux session than takes on the hotkey window's size as the default window size instead of the size from my profile.
One of the *Window* configuration options for an iTerm2 profile is *"Always open in a new window, never in a tab"*, but this even overrides using Cmd-t that would typically open in a Tab, so does not work.
**I am looking for:** a way to have the new profile (invoked with a shortcut key) to always open in a new Window, while having Cmd-t respected as a *new tab*.
One way I imagine doing this is having iTerm2 open a new profile in a new window only if the profile is different that the current window's profile.
I am open to any solution here.
Marcin K
(111 rep)
Jan 9, 2025, 01:00 AM
• Last activity: Jan 10, 2025, 10:32 AM
Showing page 1 of 20 total questions