question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

iTerm nightly compatibility

See original GitHub issue

I run iTerm nightly (using homebrew cask) but I’d been having issues with Sublime Terminal. I reported it the iTerm developer George Nachman and he cleaned up the iTerm.sh file. His version opens in a new tab of the current terminal by default, which I consider to be the best anyway.

The cleaned up version is available at https://gist.github.com/gnachman/b9ae9cf06c44b5a95edf and it seems reasonable to use it, but I’ll hold off for feedback before doing a pull request.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:33 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
KyleKingcommented, Jun 23, 2016

Nothing special, I just tossed in an activate call in three places (too bad GFM doesn’t support highlighting a specific line)

#!/bin/bash

# Modified following this issue: https://github.com/wbond/sublime_terminal/issues/89

CD_CMD="cd "\\\"$(pwd)\\\"" && clear"
if echo "$SHELL" | grep -E "/fish$" &> /dev/null; then
  CD_CMD="cd "\\\"$(pwd)\\\""; and clear"
fi
VERSION=$(sw_vers -productVersion)
OPEN_IN_TAB=0

while [ "$1" != "" ]; do
    PARAM="$1"
    VALUE="$2"
    case "$PARAM" in
        --open-in-tab)
            OPEN_IN_TAB=1
            ;;
    esac
    shift
done

if (( $(expr $VERSION '<' 10.7) )); then
    RUNNING=$(osascript<<END
    tell application "System Events"
        count(processes whose name is "iTerm")
    end tell
END
)
else
    RUNNING=1
fi

if (( ! $RUNNING )); then
    osascript<<END
    tell application "iTerm"
            tell current window
                tell current session of (create tab with default profile)
                    write text "$CD_CMD"
                end tell
            end tell
            activate
    end tell
END
else
    if (( $OPEN_IN_TAB )); then
        osascript &>/dev/null <<EOF
        tell application "iTerm"
                    if (count of windows) = 0 then
                        set theWindow to (create window with default profile)
                        set theSession to current session of theWindow
                    else
                        set theWindow to current window
                        tell current window
                            set theTab to create tab with default profile
                            set theSession to current session of theTab
                        end tell
                    end if
                    tell theSession
                        write text "$CD_CMD"
                    end tell
                    activate
        end tell
EOF
    else
        osascript &>/dev/null <<EOF
        tell application "iTerm"
                    tell (create window with default profile)
                        tell the current session
                            write text "$CD_CMD"
                        end tell
                    end tell
                    activate
        end tell
EOF
    fi
fi
4reactions
matthias-vogtcommented, Mar 17, 2016

@jcrben cleaned version didn’t work for me until I changed

tell application "System Events"
    count(processes whose name is "iTerm")
end tell

…to

tell application "System Events"
    count(processes whose name is "iTerm2")
end tell

using iTerm 2.9.20160313

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nightly - iTerm2 - macOS Terminal Replacement
Every night at midnight Pacific time, a new nightly build is made if a ... Nightly builds are saved in perpetuity and older...
Read more >
iTerm2 Python binary not compatible with macOS 10.13.6
iTerm2 Python binary not compatible with macOS 10.13.6. iTerm2 version: 3.3.20200426-nightly; OS version: macOS 10.13.6; com.googlecode.iterm2 ...
Read more >
Breaking applescript to make it better - please provide feedback
The change will become effective in the nightly builds soon. It will break backward compatibility but I think it'll make life better for...
Read more >
Bryan Liles on Twitter: "Iterm scares the notch on my new Mac ...
Iterm scares the notch on my new Mac away. ... Latest nightly. ... I think this is the compatibility behavior with apps that...
Read more >
Trzsz-iTerm2 Document
... a simple file transfer tools, which similar to lrzsz ( rz / sz ), and compatible with tmux. ... Upgrade iTerm2 to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found