# Building on OSX

**URL:** <https://www.ruby-forum.com/t/building-on-osx/127983>\
**Category:** IronRuby\
**Created:** [February 3, 2008, 8:55pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983 "2008-02-03T20:55:29Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![xjivan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xjivan](https://www.ruby-forum.com/u/xjivan)\
**Post date:** [February 3, 2008, 8:55pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983/1 "2008-02-03T20:55:29Z")

</div>

Hi

I have a hard time getting ironruby to build on OSX  
I first tried with the dmg image I can download from the mono-project.  
After  
I tried with building mono from subversion.  
Am I missing something obvious ?

ivan-mbp:ironruby ivan$ rake compile mono=1  
(in /Users/ivan/tools/ironruby)  
Read in 47 resources from  
‘/Users/ivan/tools/ironruby/src/microsoft.scripting/Resources.resx’  
Writing resource file… Done.  
Read in 17 resources from  
‘/Users/ivan/tools/ironruby/src/microsoft.scripting/Math/MathResources.resx’  
Writing resource file… Done.  
error CS0006: cannot find metadata file  
`mono/2.0/System.Configuration.dll' error CS0006: cannot find metadata file`mono/2.0/System.dll’  
Compilation failed: 2 error(s), 0 warnings  
rake aborted!  
Command failed with status (1): [/opt/local/mono/bin/gmcs /nologo  
/noconfig…]  
/Users/ivan/tools/ironruby/rakefile:197:in `exec’  
(See full trace by running task with --trace)

---

<div class="post-metadata">

**Author:** ![xjivan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xjivan](https://www.ruby-forum.com/u/xjivan)\
**Post date:** [February 3, 2008, 8:59pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983/2 "2008-02-03T20:59:38Z")

</div>

Ivan Porto C.:

> I have a hard time getting ironruby to build on OSX I first tried with  
> the dmg image I can download from the mono-project.  
> After I tried with building mono from subversion.  
> Am I missing something obvious ?

The last time I built IronRuby on a OS X I grabbed Mono from the SVN  
trunk - the dmg was really out of date.

-John

---

<div class="post-metadata">

**Author:** ![xjivan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xjivan](https://www.ruby-forum.com/u/xjivan)\
**Post date:** [February 3, 2008, 9:15pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983/3 "2008-02-03T21:15:08Z")

</div>

I did i’m trying to compile it against the mono version i got from trunk  
from yesterday

ivan-mbp:ironruby ivan$ mono -V  
Mono JIT compiler version 1.9 (/trunk/ r94512)  
Copyright (C) 2002-2007 Novell, Inc and Contributors.  
[www.mono-project.com](http://www.mono-project.com)  
TLS: normal  
GC: Included Boehm (with typed GC)  
SIGSEGV: normal  
Notification: Thread + polling  
Architecture: x86  
Disabled: none

ok … I’ll keep trying then until I get a working mono version. Haven’t  
done  
much testing with mono but I did run the minimal test suite before  
installing.  
If I compile on windows and use the binaries there is no problem.

Thanks  
Ivan

---

<div class="post-metadata">

**Author:** ![xjivan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xjivan](https://www.ruby-forum.com/u/xjivan)\
**Post date:** [February 4, 2008, 2:40pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983/4 "2008-02-04T14:40:39Z")

</div>

On Sun, 03 Feb 2008 13:14:28 -0700, Ivan Porto C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ok … I’ll keep trying then until I get a working mono version. Haven’t  
> done much testing with mono but I did run the minimal test suite before  
> installing.  
> If I compile on windows and use the binaries there is no problem.

Are you compiling with both --with-preview=yes and --with-moonlight=yes  
?

Actually, I think they both are set to yet by default, but if you’re  
building from SVN you’ll need to checkout not only the mono directory  
but  
olive, moon, mcs, and (possibly) gtk-sharp as well. You’ve already got  
mono checked out, so if you enter the same directory that the mono  
directory is contained in and run,

svn co  
svn://anonsvn.mono-project.com/source/trunk/{mcs,moon,olive,gtk-sharp}

… to then svn up mono you can then enter the mono directory and run,

./autogen.sh --with-preview=yes --with-moonlight=yes [additional options  
(such as --prefix)]

NOTE: I realize I mentioned that I believe both of these values are yes  
by  
default, but it doesn’t hurt so it’s worth adding them just in case.

If that script finishes without erroring out then run,

make; sudo make install

If it does error out there’s a good chance it’s going to be one of  
several  
things,

1. The existing DMG-based installation is getting in the way. I would  
move /Library/Frameworks/Mono.framework (if you don’t see it there, try  
~/Library/Frameworks/Mono.framework) to another directory to ensure  
you’re  
not running into a problem with the build process linking against the  
wrong libraries.
2. The generated ./configure file will have a few lines that autotools  
will claim to be invalid syntax. If you see this problem, just open the  
./configure file, go to the specified line, and comment it out.  
IMPORTANT!: Don’t rerun ./autogen.sh at this point. It will write over  
the previous generated ./configure file and cause the same error to  
occur.

At this stage of the game you’ll then want to run,

./configure --with-preview=yes --with-moonlight=yes [additional options  
(such as --prefix)]; make; sudo make install

At this point you’re system should be completely up-to-date with all of  
the latest code that is specific to the needs of the DLR and DLR-based  
languages. That doesn’t mean it’s guaranteed to compile and work, but  
I’ve yet to find a situation unrelated to System.Windows.Forms that  
didn’t  
work on OS X if it worked on Linux. It sometimes takes a bit of hacking  
the build process, but it usually works out in the end. 😃

That said, given the IronRuby and the DLR are moving targets, there’s no  
guarantee you’re not going to run into issues. But in my own  
experience,  
the Mono team places an extremely high importance on bugs related to the  
Iron\* projects and the DLR. Often times there’s a fix checked into SVN  
within a few hours of filing the report.

Hope this helps!

–  
/M:D

M. David P.  
Co-Founder & Chief Architect, 3rd&Urban, LLC  
Email: removed\_email\_address@domain.invalid | removed\_email\_address@domain.invalid  
Mobile: (206) 418-9027  
[http://3rdandUrban.com](http://3rdandUrban.com) | [http://amp.fm](http://amp.fm) |  
[http://www.oreillynet.com/pub/au/2354](http://www.oreillynet.com/pub/au/2354)

---

<div class="post-metadata">

**Author:** ![xjivan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xjivan](https://www.ruby-forum.com/u/xjivan)\
**Post date:** [February 4, 2008, 9:31pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983/5 "2008-02-04T21:31:46Z")

</div>

I’ve got it working now.

Thanks for all your help :).  
Turns out I have to set a variable PKG\_CONFIG\_PATH in .bash\_profile that  
includes the path which has the mono.pc file in it. I don’t have to edit  
anything anymore and it compiles

Thanks  
Ivan

---

<div class="post-metadata">

**Author:** ![xjivan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xjivan](https://www.ruby-forum.com/u/xjivan)\
**Post date:** [February 4, 2008, 8:58pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983/6 "2008-02-04T20:58:31Z")

</div>

Thanks guys, I got it to build.  
I do feel slightly dirty because it’s somewhat hacky. (I’m very, very  
new to  
OSX) but I edited the Rakefil and set the libdir specifically there

FRAMEWORK\_DIR = ‘/opt/local/mono/lib/mono/2.0/’ #Pathname.new(libdir) +  
‘mono’ + ‘2.0’

I’m not entirely happy with this solution and it probably has something  
to  
do with an environment variable not being set correctly, but at least i  
know  
it can be done now and eventually I’ll get it so that the standard rake  
file  
suffices.

I’ve seen that the command ‘pkg-config --variable=libdir mono’ doesn’t  
return anything, which may be the cause 🙂

Cheers  
Ivan

---

<div class="post-metadata">

**Author:** ![xjivan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xjivan](https://www.ruby-forum.com/u/xjivan)\
**Post date:** [February 4, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983/7 "2008-02-04T22:06:07Z")

</div>

On Mon, 04 Feb 2008 12:57:48 -0700, Ivan Porto C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> I’ve seen that the command ‘pkg-config --variable=libdir mono’ doesn’t  
> return anything, which may be the cause 🙂

Looks like you need to add /opt/local/lib/pkgconfig to your  
PKG\_CONFIG\_PATH environment variable.

–  
/M:D

M. David P.  
Co-Founder & Chief Architect, 3rd&Urban, LLC  
Email: removed\_email\_address@domain.invalid | removed\_email\_address@domain.invalid  
Mobile: (206) 418-9027  
[http://3rdandUrban.com](http://3rdandUrban.com) | [http://amp.fm](http://amp.fm) |  
[http://www.oreillynet.com/pub/au/2354](http://www.oreillynet.com/pub/au/2354)

---

<div class="post-metadata">

**Author:** ![xjivan](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/6f9a4e/32.png) [@xjivan](https://www.ruby-forum.com/u/xjivan)\
**Post date:** [February 4, 2008, 10:06pm UTC](https://www.ruby-forum.com/t/building-on-osx/127983/8 "2008-02-04T22:06:07Z")

</div>

On Mon, 04 Feb 2008 13:31:04 -0700, Ivan Porto C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Turns out I have to set a variable PKG\_CONFIG\_PATH in .bash\_profile that  
> includes the path which has the mono.pc file in it. I don’t have to edit  
> anything anymore and it compiles

Should have read your follow-up first. 😉

–  
/M:D

M. David P.  
Co-Founder & Chief Architect, 3rd&Urban, LLC  
Email: removed\_email\_address@domain.invalid | removed\_email\_address@domain.invalid  
Mobile: (206) 418-9027  
[http://3rdandUrban.com](http://3rdandUrban.com) | [http://amp.fm](http://amp.fm) |  
[http://www.oreillynet.com/pub/au/2354](http://www.oreillynet.com/pub/au/2354)
