iOS Tutorial - How to add and configure mogenerator in Xcode 5

Adding mogenerator

1.) Go to and download mogenerator.   You could also install mogenerator via homebrew if you'd like too.  Instructions are below the download image (as shown below):

2.) After downloading the mogenerator DMG file, mount the image by double-clicking on it and then click on the package file to start installing it.  Let the installer run and finish.


Configure mogenerator for your project

1.) In Xcode, with your project open, click on your Xcode project in the project navigator to bring up the properties for your project:


2.) Click on the boxed arrow icon, directly to the right of the navigator, to expand a sidebar that will let you see what targets are available:


3.)  Click on "Add Target..."


4.) In the "Choose a template for your new target" window, click on "Other" under "iOS" on the left hand side.


5.) Then click on "Aggregate", then click "Next".  (You can also double-click "Aggregate" so you don't have to click "Next".)


6.) On the next screen, put whatever name you want for the "Product Name", then click "Finish".


7.) Make sure that your new target is selected:


8.) Then select the "Build Phases" tab:


9.) Then select "Editor" and navigate your way to "Add Run Script Build Phase".




10.) "Run Script" will get added to your "Build Phases" for your new target.  Expand "Run Script" by click on the arrow.



11.) In the box that says, "Type a script or drag a script file from your workspace to insert its path", copy and paste the following into that box:

mogenerator -m ProjectName/NameOfCoreData.xcdatamodeld -O ProjectName/Model --template-var arc=true
  • Replace "ProjectName" with the actual name of your project that mogenerator will be used in. (This appears twice.)
  • Replace "NameOfCoreData" with the name of your core data model.



12.)  Press Command + B to build.  If you have entities already in your core data model, then class files should have been created for those entities.  BUT you have to manually add those class files to the project.


This tutorial was based on how I went completing it with help from: