19

I'm trying to use Mogenerator in my iOS project developed in Xcode 5. I've installed Mogenerator with brew:

brew install mogenerator

then link:

brew link mogenerator

After that I have access to this tool from my command line.

Next I'm trying to add one more step (script executing) in build phases (shell /bin/sh):

mogenerator --model "${PROJECT_DIR}/MyProject/Model.xcdatamodeld/Model.xcdatamodel" --output-dir "${PROJECT_DIR}/MyProject" --template-var arc=true

In effect I get error:

line 2: mogenerator: command not found
Command /bin/sh failed with exit code 127

Do you have any advices how can resolve this issue?

Gie
  • 1,907
  • 2
  • 24
  • 49

1 Answers1

27

If /usr/local/bin is not in the search path used by Xcode, you can call mogenerator with an absolute (full) path:

/usr/local/bin/mogenerator --model ...
Martin R
  • 529,903
  • 94
  • 1,240
  • 1,382
  • Thanks Martin, if I specify full path then everything works properly. Do you know how can I add /usr/local/bin/ path to by used by Xcode? – Gie Oct 08 '13 at 14:02
  • 1
    @Grzegorz: I don't know. It seems that Xcode has a hard-coded search path. If you inspect the build logs, you will see something like `setenv PATH "...:/usr/bin:/bin:/usr/sbin:/sbin"`. I have no idea if or how that can be modified. – Martin R Oct 08 '13 at 14:16
  • 1
    @Grzegorz: I just found this: http://stackoverflow.com/questions/932424/where-is-path-set-in-xcode. It seems that you can set a custom path by creating a file `~/.MacOSX/environment.plist` (but I did not try it yet). – Martin R Oct 08 '13 at 14:20