Quantcast
Channel: Compile and run in Mac Terminal Sublime Text files - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Compile and run in Mac Terminal Sublime Text files

$
0
0

I'm working with a Mac and I want to compile and run my C files from the Terminal using a script. I've found a solution that apparently works in Linux. Here is the article in Spanish (http://ayudasprogramacionweb.blogspot.com.es/2013/01/ejecutar-en-terminal-linux-sublime-text.html). It consists in two simple steps:

  1. You create a script in linux to compile and execute the source code in the Terminal and you store it in your Documents folder named as runC.sh.

    #!/bin/bash        gnome-terminal -e "/bin/bash -c 'gcc -Wall $1 -o $2; ./$2; echo; read -p 'Press_enter_to_scape...'; exit; exec /bin/bash'; &"
  2. Through a Sublime Text Build System, you call this script by passing as parameters the name of the source file.

    {"cmd": ["~/Documents/runC.sh ${file_name} ${file_base_name}"],"shell": true}

I've tried it in my Mac but as I expected it doesn't work... Could you help me to adapt it for Mac OS please? I've just started programming and I don't know where to start to fix it... thank you very much!


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images