Macos – Opening a new terminal from the command line and running a command on Mac OS X

command linemacosterminal

Is there a way of opening a new terminal from the command line, and running a command on that new terminal (on a Mac)?

e.g., Something like:

Terminal -e ls

where ls is run in the new terminal.

Best Answer

osascript -e 'tell app "Terminal"
    do script "echo hello"
end tell'

This opens a new terminal and executes the command "echo hello" inside it.

Related Question