Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hiroMTB/306e414ec460a1a49c5657817a1313f6 to your computer and use it in GitHub Desktop.
Save hiroMTB/306e414ec460a1a49c5657817a1313f6 to your computer and use it in GitHub Desktop.

How to codesign openFrameworks app without Apple developer license?

When I send openFrameworks app to my frined, app does not find data folder. This is because of "translocation", known issue on openFrameworks forum. There are couple of solution to avoid translocation but here I tried different way by codesigning. But quesion is, is it possible to codesign wihout Apple Developer license? Looks like possible...? https://stackoverflow.com/questions/27474751/how-can-i-codesign-an-app-without-being-in-the-mac-developer-program/27474942

Create Certificate

  1. Open Keychain Access.

  2. Choose Keychain Access > Certificate Assistant > Create Certificate ... cert1

  3. Enter a name

  4. Set 'Certificate Type' to 'Code Signing' cert2

compile oF app

  1. just use xcode and compile

codesign

cd to/oF/apps/myApp
sudo codesign -fs "my-new-cert" myApp.app/Contents/Frameworks/libfmodex.dylib
sudo codesign -fs "my-new-cert" myApp.app
sudo codesign -dv myApp.app

Check

  1. zip app with data folder
  2. send or upload app via internet
  3. open

Data folder Packaging

Do you want to put /data folder inside of the myApp.app?

  1. Call ofSetDataPathRoot("../Resources/data/"); function from main.cpp or ofApp.cpp
  2. Compile app with AppStore scheme
  3. Make sure you have all data in myApp.app/Contents/Resources/data
  4. Codesign like explained above
  5. Done! Now you have codesigned, no security alarm, single package app ready to send to your friend.

Notice about timing of ofSetDataPathRoot()

I recommend to call ofSetDataPathRoot() in the very begining of main.cpp like example below.

#include "ofMain.h"
#include "ofApp.h"

int main(){
  ofSetDataPathRoot("../Resources/data/");    
  ofSetupOpenGL(1920,1080,OF_WINDOW);
  ofRunApp(new ofApp());
}

If we call ofSetDataPathRoot() in ofApp::setup(), app could crash or missing data. For example you have custom class which load data in its constructor, it can not find data. This is because your constructor can be called before ofApp::setup(), hence it try to find default data path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment