Skip to content

Instantly share code, notes, and snippets.

@gnachman
Last active April 27, 2018 05:44
Show Gist options
  • Save gnachman/f61614d0335e185787b0 to your computer and use it in GitHub Desktop.
Save gnachman/f61614d0335e185787b0 to your computer and use it in GitHub Desktop.
Fix docker quickstart terminal for iTerm2 version 2.9 and later
-- Copy this over "/Applications/Docker/Docker Quickstart Terminal.app/Contents/Resources/Scripts/iterm.scpt"
set itermRunning to (application "iTerm" is running)
set scriptPath to quoted form of POSIX path of ((path to me as text) & "::" & "start.sh")
set user_shell to do shell script "dscl /Search -read /Users/$USER UserShell | awk '{print $2}'"
tell application "iTerm"
activate
if not (exists window 1) or (itermRunning = false) then
reopen
end if
try
tell current window
set newTab to (create tab with default profile)
tell current session of newTab
write text "bash --login " & scriptPath
end tell
end tell
on error
tell current session of (create window with default profile)
write text "bash --login " & scriptPath
end tell
end try
end tell
@devinus
Copy link

devinus commented Mar 6, 2016

This doesn't seem to work with iTerm2 2.9.20160206.

@devinus
Copy link

devinus commented Mar 6, 2016

@maxromanovsky
Copy link

Agreed, initial version works fine

@syhily
Copy link

syhily commented Mar 15, 2016

Tks, initial version works.

@adriaant
Copy link

adriaant commented Apr 7, 2016

Initial version is the one to use, indeed.

@gejiawen
Copy link

Yeah, the first version works fine indeed.

@skyuplam
Copy link

skyuplam commented May 1, 2016

Agree that only the version https://gist.github.com/gnachman/f61614d0335e185787b0/ea7a3f7b248390efa886557f6917e12a6c9c0cd6 works. Thanks @devinus

  • iTerm2 version: 2.9.20160426 beta

@dgraziotin
Copy link

Many thanks for this.

@mkows
Copy link

mkows commented Jun 2, 2016

@pedrocarrico
Copy link

Yup, works fine for iTerm2 ver 3.0.0 👍

@Jake-Day-Williams
Copy link

Works for iTerm2 Build 3.0.0

For those of you new to terminal commands copy and paste this into your terminal.
open -a Atom /Applications/Docker/"Docker Quickstart Terminal.app"/Contents/Resources/Scripts/iterm.scpt

This will open the file you need to copy over in the Atom Editor. You might see strange characters in the file. That's okay. Copy over them with the code above and save the file.

If you're using another Editor replace "Atom" with the name of it. Example:
open -a TextWrangler /Applications/Docker/"Docker Quickstart Terminal.app"/Contents/Resources/Scripts/iterm.scpt

If you're new or rusty with the Terminal here's some insights. (I'm on a Mac.)

cd Applications will call the current user applications. Typing "ls" will typically list just some Chrome stuff in there.
cd /Applications will call the path your machine applications are on. Those are the ones you see listed in Finder.

When you need to cd a Folder or File name that uses spaces and not dashes or underscores you need to wrap the full name in quotations. We did this with "Docker Quickstart Terminal.app" for example.

@zanuka
Copy link

zanuka commented Jun 15, 2016

thanks, the script patch works perfectly in Build 3.0.2

@jenga
Copy link

jenga commented Jun 27, 2016

Thanks for this! I can confirm that revision https://gist.github.com/gnachman/f61614d0335e185787b0/ea7a3f7b248390efa886557f6917e12a6c9c0cd6 works with Build 3.0.2 . However, your latest revision does not.

@sijnc
Copy link

sijnc commented Jun 28, 2016

Looks like Docker Toolbox has been patched but not yet released, I used the script from the commit and it worked great:

https://github.com/virajkanwade/toolbox/blob/b45ae79a4b7eb16e397b759c53cac8d5c0da134c/osx/mpkg/quickstart.app/Contents/Resources/Scripts/iterm.scpt

I used the cmd below to edit the file with sublime:

open -a "Sublime Text" /Applications/Docker/"Docker Quickstart Terminal.app"/Contents/Resources/Scripts/iterm.scpt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment