The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Hello, I've been trying to manually compile the master branch for the Godot engine to directly generate an executable, but I'm having trouble when trying to generate an executable supporting the mono environment.

I have tried following the guide in the docs, but I can't get pass the Generate the Glue part. Whenever I run the command:

$ scons p=osx tools=yes module_mono_enabled=yes mono_glue=no

I get the following output:

scons: Reading SConscript files ...
Package monosgen-2 was not found in the pkg-config search path.
Perhaps you should add the directory containing `monosgen-2.pc'
to the PKG_CONFIG_PATH environment variable
No package 'monosgen-2' found
OSError: 'pkg-config monosgen-2 --libs-only-L' exited 1:
  File "/Users/ericdesedas/Development/projects/godot/godot_source/SConstruct", line 398:
  File "./modules/mono/", line 162:
    tmpenv.ParseConfig('pkg-config monosgen-2 --libs-only-L')
  File "/usr/local/Cellar/scons/3.0.1/libexec/scons-local/SCons/", line 1557:
    return function(self, self.backtick(command))
  File "/usr/local/Cellar/scons/3.0.1/libexec/scons-local/SCons/", line 594:
    raise OSError("'%s' exited %d" % (command, status))

I tried following the error's instructions about adding the PKG_CONFIG_PATH variable, but I still get the same error.

I have already checked the following possible issues:

  • I already have the latest mono version installed (,
    which was installed via the official mac package (not using the
    brew version).
  • Already set the MONO_PATH env variable (pointing to
    just to make sure my installation was going to play nice with the
    editor. I can run the official beta build provided in the latest
    news update
  • I defined the PKG_CONFIG_PATH env variable (pointing to
    and I can confirm that the path contains the file monosgen-2.pc
    (the one the error is complaining about).
  • I can compile without mono doing the typical scons p=osx command.

Is there anything else I need to do so that I can compile the source code?

in Engine by (33 points)

The issue was resolved for me by setting the PKGCONFIGPATH as so

export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/5.4.1/lib/pkgconfig/

Cool, just came here from google and above exports fixed my problem

1 Answer

+1 vote
Best answer

Hi Eric,

I had the same issue and have just spent a good few hours trying to remedy it - I even reset my MacBook to see if it was something wrong with my setup. But I think I've found a solution.

It involves modifying the {godot dir}/modules/mono/ file by adding tmpenv = Environment(ENV = os.environ) right above tmpenv.ParseConfig('pkg-config monosgen-2 --libs-only-L'), which as far as I can tell is the point of failure, and using the following build script:

export PKG_CONFIG_PATH=/Library/Frameworks/Mono.framework/Versions/Current/lib/pkgconfig
echo "========Building GODOT without mono glue========"
python p=osx target=release_debug tools=yes module_mono_enabled=yes mono_glue=no
echo "========Generating mono glue========"
bin/ --generate-mono-glue modules/mono/glue
echo "========Building Godot with Mono========"
python p=osx target=release_debug tools=yes module_mono_enabled=yes
echo "========Copying App Bundle========"
cp -r ./misc/dist/ ./bin/
echo "========Copying executable to App Bundle========"
mkdir ./bin/
cp ./bin/ ./bin/
echo "Done!"

(I'm using scons-local placed in the godot directory created by git, hence the python - if you're using the global version of scons replace this with just scons)

I hope this helps!

by (52 points)
selected by

this worked for me too, thanks! have you thought of submitting a pull request on github?

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.