I am looking for a script-based solution executed in the command line.

Open a new window of terminal at specified ~/desktop

open -na terminal ~/desktop

Open a terminal tab

osascript -e 'tell application "Terminal" to activate' -e 'tell application "System Events" to tell process "Terminal" to keystroke "t" using command down'

How to open a terminal tab at a particular dir.

  • 1. Opening a new tab in Terminal retains the current directory by default! 2. With this knowledge the question answers the question: do some more keystrokes "cd ...." and finally the Enter key ;-)
    – klanomath
    Nov 24, 2017 at 23:42
  • Your first command for opening a new window actually opens an entirely new Terminal application instance, which will recreate any windows existing in the current instance!
    – grg
    Jan 25, 2018 at 9:53

1 Answer 1


In MacOS 10.13.2 (but possibly/probably in earlier versions too):

    directory=~/Downloads; osascript -e "tell app \"terminal\" to do script \"cd $directory\"" 

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .