iTerm2 execution error: Can’t get application "iTerm"
jamesone opened this issue · comments
When trying to use ttab
via iTerm2:
0:7: execution error: Can’t get application "iTerm". (-1728)
139:145: syntax error: Expected end of line but found class name. (-2741)
macOS: 10.12.6
Node: v8.6.0
Installed with: npm i -g ttab
What do the following commands return on your system, in order?
osascript -e 'version of application "iTerm"'
osascript -e 'version of application "iTerm2"'
echo $TERM_PROGRAM
If these don't work, use the About
dialog to tell me what iTerm version you're running.
Generally, the code uses (The code does handle versions differently, but it relies even on 3.x to respond to iTerm
in the embedded AppleScript code only for versions 1.x and 2.xiTerm
).
0:7: execution error: Can’t get application "iTerm". (-1728)
(I uninstalled iTerm 1, I only have iTerm2)3.2.0beta6
iTerm.app
Did you plan on adding iTerm 3.x support? (in beta)
Confirmed: iTerm 2.x works
I'm actively using both 3.2.0beta8
and 3.1.7
and I don't see the problem.
Can you please update to 3.2.0beta8
and tell me if you still see the problem?
When trying to run iTerm 3.2.0beta8
, I get:
170:178: syntax error: Expected “,” but found identifier. (-2741)
Before I moved iTerm1 to the trash (so I have iTerm1 & 2 installed in the Applications folder): When I run ttab
inside iTerm2, it'd open a new tab inside iTerm1
While I have no specific explanation, I'm not surprised that side-by-side installation of iTerm1 and iTerm2 causes problems due to competing OSA dictionaries, given that both version use the application name iTerm.app
.
I suggest deleting the iTerm1 version, emptying the trash, and rebuilding the dictionaries with the following command:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user
I just did this ^ and now I get:
0:7: execution error: Can’t get application "iTerm". (-1728)
139:145: syntax error: Expected end of line but found class name. (-2741)
This is the same error as my first one
Without access to your system, I'm afraid I can't diagnose this any further.
You can try the following stopgap - assuming that osascript -e 'version of application "iTerm2"'
works - which you'll have to reapply every time you update ttab
:
-
Use
which ttab
to locate thettab
executable. -
Open it for editing and locate the following line:
[[ $(osascript -e 'version of application "iTerm"') =~ ^(1|2) ]] && iTermOld=1 || iTermOld=0
- Replace it with the following:
iTermOld = 0
- Locate the following line:
terminalApp='iTerm' # will be used with `activate application`
- Replace it with:
terminalApp='iTerm2' # will be used with `activate application`
I'm closing this for now, but if we find the true cause and a general fix I'm happy to reopen it.
Fixed Build 3.1.7
(i was previously on the beta)
Thanks so much for your help and time!
@jamesone: My pleasure; I'm glad you found a solution.