Sublime Forum

Send code output to Mac terminal or other terminal emulators


Hey there.

I am currently using terminus to see the code output of my files. But since I am using a laptop , the terminal panel quite a bunch of space.

Is there a way with the build system, and plugins, to send the code output to an external terminal window in Mac . Therefore each time I build , (if the terminal app is not open it opens it), it shows the code out in the terminal app, rather than a bottom pane.

And is still seamless like terminus.(I won’t lie terminus is the only reason I am using sublime over vs code, just because its so fast.)



Also I have already tried the “target” :“terminus_open” feature , it is something similar to what I am looking for. But It opens a new window each time, I build.

I want sublime to just have one window , to show code outputs from any filetype or build system.



You can make a build system execute any external program, and provide that program any arguments that you like. So it’s entirely possible to create a build system that will open an external terminal and then run something inside of it, yes.

How you do that is different depending on the operating system that you’re using; for MacOS, the process is outlined here:



Hey OdatNurd, thanks for the help. I have watched your several videos to help me setup Sublime. They were great help.

I watched the above video too , and followed the step.

  1. Create and edit a file.
  2. Create a new build system, with the path variable set to the location of .sh file.

Although I got the following error.
“doesn’t understand the “do script” message. (-1708)”

Also I am using zsh on my Mac, do you think that might be the reason.

Here is my build for java:

"shell_cmd": " javac \"$file\" && java \"$file\"",
"working_dir": "$file_path",
"selector": "",
"file_regex": "^(...*?):([0-9]*):?([0-9]*)",

This I similar to my terminus build with the additional command, and the “env” var.



The first line in the script tells it to run in the standard shell, so I don’t think that’s an issue.

The error message is coming from osascript and looks to me like perhaps Terminal doesn’t understand the request that the script is sending it. What version of MacOS are you using?



I am using macOS Bug Sur Version 11.4 (latest one), and my zsh version is zsh 5.8.



Unfortunately my version of MacOS is a bit older (and my Mac is too old to upgrade to the latest versions).

As a test, you could try running the command manually from a bash shell to see if that affects what happens.

That said, build systems that use shell_cmd on Linux/MacOS always execute using bash regardless of what your shell is set to, so I don’t think that will help much.



Both zsh and bash , say the command generated , found no such file or directory.

Guess I just have to use terminus.



Someone with a newer version of MacOS and the scripting host may be able to provide some insight into why this doesn’t seem to work in that version of MacOS, but unfortunately I’m not in a position currently to provide that kind of assistance; sorry about that.