How to compile OF from the command line so you can break up with xcode and use atom or sublime

Hey folks -

Anyone else here want to take a baseball bat to the xcode IDE on a regular basis and wish they could use Atom for code development in OF?

If so, here’s a handy guide. It’s super dead simple.

  1. Go install atom if you haven’t now. This should also work for sublime, or even VIM.

  2. Add OF to your system’s path. To do this you need to find a hidden file. Open up terminal and use this unix command to do it. Steps 3-5 will walk you through it.

  • Open terminal and simply cd and press enter
  • type open .bash_profile (or open this file in your editor of choice. If you have atom installed you can use atom .bash_profile)
  • add this line at the bottom of the file, then save and quit your text editor export OF_ROOT=~/Documents/of_v0.9.8_osx_release
    (If you find this past this release, just update this to be whatever version of of you have downloaded, such as 9.9)

Now generate your OF project using the project generator. Go to atom or sublime and edit away. When you’re done, you’ll pop over to the terminal and change directory into your project’s root folder.

If you’re a total new soul cd is the Unix command to change directory. For example, cd ~/Documents would take you to your Documents folder. The ~ represents your user root directory. This should have your Desktop, Photos and Documents in it.

After you’ve changed directory into your project folder, all you have to do is type make on the command line. Yes, that’s it. They’ve now included make files with OF. Nice work folks. It will do all the heavy lifting for the compilation. The unix command make is a command that uses this utility called make to compile your applications. It’s really robust and cool and you can learn more about it here:

It ships with your mac. You shouldn’t need to install it.

Read how to launch your app from here - it’s dead simple and make will explain it when it’s done building for you. Just read what it prints out about it in terminal.

Cheers! :smiley:


you can also use atom’s build-make plugin to directly build and run from inside atom without having to go back and forth from a console and the atom linter plugin is also a nice one to have installed so it marks errors inlined in the code while compiling.

SO GOOD! Has anyone set up an OF autocomplete yet?

there’s the auto complete clang plugin:, it requires some file per project which telss the plugin where to look for headers… it’s easy to make the makefiles emit such a file but last time i tried it it was too slow for OF, OF includes so many headers that also makes available to users right away that it makes most auto complete systems really slow.

it seems that the plugin now supports precompiled headers which might make things faster but not sure how easy it would be to generate them, in any case it surely needs some modification on the makefiles

Couple other quick tips to add:

  • make Debug will generate a binary with debugger hints included so you can load it up in gdb or similar (using gdb with OF is probably a topic all on its own).
  • make run will run the binary after it’s been compiled [I would expect it to automatically compile if necessary, but at least on linux it doesn’t see to do that. I’m going to report it as a bug. In the meantime, `make && make run` should work as a general “compile and run” command]
  • make clean should clean everything up, deleting the binary and any intermediate files (.so's and such)
1 Like

oh and there’s also atom-gdb which allows to debug the binaries and gives the traditional tools for debugging on any IDE

I’m toying with Visual Studio Code (similar to atom), I was able to setup ofApps and build from the editor. Intellisense and debugging are working too in osx.

I didn’t use make though, I’m calling xcodebuild which is probably overkill… Are makefiles generated for all apps by default? Or do you need to target linux in PG?

My idea was to just wrap xcodebuild, msbuild or make; depending on which platform you’re developing on. This way you can have the same editor in all OSs.

The make route wouldn’t work out of the box for Windows… I do have a fork of the PG for vsc support; but there’s nothing working yet

I’m not sure if this would be a welcome addition to mainstream OF-PG

Ah! I’m so close but I can’t make it work yet! I have the build-make plugin and Atom is compiling a project, but not running it. The make plugin only sees the default target. How do I get it to actually run the project?

I use AppCode for Xcode projects, instead of Xcode itself. Personally I find it a much better IDE and has excellent refactoring tools. It is a nice environment for developing oF apps on macOS.

Oh! Yay for using Editors to code! :slight_smile: did anyone get Auto Complete to work under Sublime Text 3? It’s my editor of choice since almost 6 years and I’d just love to not have to switch to Atom… although I know it’s great :slight_smile: any help greatly appreciated!

On Mac and Linux I’ve been using make since 0.9.4 as far as I can remember.

On Windows it’s also possible to use make as long as you have msys2 installed like described in this page

No need to modify your bash profile

1 Like

Hi Arturo! Hey can I get a guide to doing this? I can see the make package is installed - do I need a terminal or something to call it or is it hiding in the menu somewhere?

i think F9 builds. I haven’t used the make build package but with other languages you also get the possible targets in the lower left corner where you can select which target to build

also usually in the package settigns there’s instructions on how to use it or a link to the web for that package

Thanks man - they are scarce in that package but it’s most likely I am missing a readme. I’ll dig about.

Thanks for sharing this. I did a little follow up detailing how I can to trigger the Makefile from Vim, taking into account the parent directory:

1 Like

Thanks so much for this, it’s great!

One question … on the command line I get hundreds of lines of output with the [verbose] prefix. It’s not my app that’s generating these messages, so I imagine it’s an oF dependency. They’re just nonsense:

[verbose] ttypd
[verbose] ptypd
[verbose] ttype
[verbose] ptype
etc etc ...

Is there any way to turn off verbose output? It makes it really hard to read the useful output. I tried messing with the log level enum in ofLog.h but that crashed everything.

Thanks again for an excellent thread!

setting up as per step though but getting

Makefile:13: /Users/danbuzzo/libs/openFrameworksCompiled/project/makefileCommon/ No such file or directory
make: *** No rule to make target `/Users/danbuzzo/libs/openFrameworksCompiled/project/makefileCommon/'.  Stop. '

the bash profile has

and echo $PATH gives :


which appears to show the correct root for oF - what am I overlooking here?



I don’t want to do some self-promotion, but I wrote an article about this kind of workflow in the past, so maybe you’ll find it useful! @danb

It would be awesome to have some an autocomplete extension on VSCode, I would totally spend some time working on it if somebody could give me a few pointers! (no pun intended)

so the path shoud be:

~/Developer/of_v0.10.0_osx_release/libs/openFrameworksCompiled/project/makefileCommon/ No such file or directory


/Users/danbuzzo/libs/openFrameworksCompiled/project/makefileCommon/ No such file or directory

anyway can you try just checking that the app your are trying to compile is in the apps or examples folder of oF and try to compile it without setting the OF_ROOT ?

thanks @vvzen @npisanti for the feedback and advice - also the link to the blog post - how is Goldsmiths going? I run the MSc in Creative Technology in Bristol so we are covering some similar area :smiley:

as is the wisdom of Moz and the IT Crowd, for no clear reason (possibly just rebooting the machine and not just terminal) everything is fine today and compiling as it should.

1 Like