It's certainly possible. The Terminal basically just runs a shell (bash by default). You could just launch an app that forwards entered text onto bash, and let bash do the work. Or you could interpret the input yourself. Bash is pretty simple, for the most part: you type in a program and arguments, it finds the program in the $PATH
, and launches it with the given arguments. (Of course, bash gets a bit fancier, which pipes, input/output redirection, scripting, background tasks, etc., but if you don't need that in your application, you could ignore those features.) You can use NSTask
, system(3)
, or the exec
family of tasks to launch processes (probably NSTask
is your best bet).