0

I cannot get iTerm2's shell integration work with oh-my-bash. I already tried the suggestions in the existing posts but without luck. My configuration looks as follow:

  • iTerm2 profile
    • General -> Command -> Custom Shell: /usr/local/bin/bash
    • Send text at start: source ~/.bashrc (required to activate oh-my-bash)
  • My login shell (according to chsh): /usr/local/bin/bash

I have installed the iTerm2 Shell integration using the integrated installer.

Removing the Send text at start command makes the Shell integration work, however, also disabled oh-my-bash. I tested it, for example, using the Shift+cmd + shortcut which allows jumping between marks.

Approaches

I tried playing around with

  • iTerm2 profile: Login Shell / Custom Command
  • Sourcing ~/.bash_profile and ~/.bashrc manually

However, I could not accomplish to have at the same time oh-my-bash enabled, the iTerm2 Shell integration working, and the tools that are initialized in ~/.bash_profile (e.g., brew and itermocil) working.

0

I finally solved it by using the following configuration:

  • iTerm2 profile
    • General -> Command -> Custom Shell: /usr/local/bin/bash --rcfile ~/.bashrc
    • Send text at start: source ~/.iterm2_shell_integration.bash; osascript -e 'tell application "System Events" to keystroke "k" using command down'

The command source ~/.iterm2_shell_integration.bash activates the shell integration. The snippet osascript -e 'tell application "System Events" to keystroke "k" using command down' clears the buffer by invoking the CMD + K keystroke – note that clear could also be used instead but this only moves the terminal's visible content and enlarging the window possibly shows the content.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.