Compile C code in atom for Mac


I was trying to look for a solution to compile code in Atom using packages, but I think there is not such a package yet. In my Mac, I can compile code using the following line on the terminal:

gcc name.c -o name

So I was wondering if there is way to make Atom use the terminal to compile the code and show the results. Thanks!


Have you tried the build package?


Not yet. How do I install it?


Like any other package. See the documentation here:


Thanks! I’ll try it here.


Now, there is another problem. How to solve this?


You’d have to check the documentation of the build package. I haven’t used it but I did do a quick read and it said that you could describe custom build tools.

How do I run my code in Atom?

I guess compilers and build configurations, are one of those areas that haven’t seen a lot of package development yet, which some users who are coming from full fledged IDEs are still missing.


@filipebcs I am the author of the package. It recognizes a few builds as seen in the readme. If you have a Makefile which builds your project, it would automatically detect this and invoke make to build your project.

If you use something less standard, you can compose a file named .atom-build.json which defines how you build your project. It would look something similar to this:

  "cmd": "gcc",
  "args": [ "-o", "myProgram" ]

Of course, you can add additional arguments, or execute another command, even another script. It supports detecting errors in the output and automatically go to that location in your code if you provide the errorMatch key. All keys are documented in the readme linked to above.

Let me know if you have any other issues.


Is there any way that I can make a generic build file that will build any C file with any name? Thanks very much for the answer!


Basically, the idea is that you have a C project and then you have a Makefile that describes how to build it, and all Atom needs to do is to invoke make. Then all the hard work goes into writing the right Makefile. This is a topic not related to Atom, however.

On many machines, make is even preconfigured so that even with an empty Makefile, you can do

make foo

And this will compile foo.c and produce an executable foo from it.


The package that I use to compile and run C/C++ codes in atom is the gpp-compiler package by kriscross07.

Refer this for more details:



OK! I’ll try that. Thank you!