I have been developing Ruby applications for the past couple years, not as my only work but part of my overall work. The IronRuby project is a large part of my work as well, not as a committer, but from a consumer standpoint. I am looking forward to the day where we can run Ruby on Rails on IronRuby and therefore IIS. I also use IronRuby for the book I am working on with a friend for Wrox Press, which I talked about previously.
I have always been a Windows developer and use Windows systems for all of my daily work. This change in the past year when I jumped on the Apple Mac bandwagon and started using a MacBook Pro. I have to say I really love it from a hardware perspective as well as from the perspective of the usability of OSX, it is just a pleasure.
This leads me to the reason for this post, getting IronRuby to build and run on a Mac under Mono.
Mono
The first part of getting IronRuby to run on the Mac is to install Mono. Mono is needed to have a .NET 2.0 available on the Mac, its current version at the time of this writing is 1.9.1. The download for the Mac is a Universal DMG Image extracting to a PKG which you just double-click and install, pretty straight forward.
I followed much of Seo Sanghyeon’s brief tutorial on the details of IronRuby on Mono but needed to make some adjustments to actually get it to work on my system. For example, I did NOT install Mono from source, I used the pre-built package.
IronRuby Source
The IronRuby team is constantly make changes to the source and not all revisions are compatible with this built process. I am sure as we get closer to release there will be more stable base of code. For right now we are on Revision 100, so the Subversion command to get the source looks like this:
svn co -r 100 http://ironruby.rubyforge.org/svn/trunk ironruby
IronRuby Build Process
The build process is where it gets a little tricky to make sure everything is lined up. The first thing is changing to the directory where IronRuby source is located:
cd ironruby
A patch needs to be applied for Rake to work properly. The patch can be found on Seo’s web site here, notice it is build revision specific and new ones will likely be available. Next up run Patch:
patch -p0 < patch-mono-r100
The next step was the key to my success, telling the Mono compiler where the needed libraries are located. The build would never work without it.
export PKG_CONFIG_PATH="/Library/Frameworks/Mono.framework/Libraries/pkgconfig/"
This export I put in my ~/.bash_profile file and closed and reopened my Terminial window. Next, run Rake:
rake compile mono=1
If all goes well the build will succeed, with likely some warnings, and you can run IronRuby:
mono build/mono_debug/ir.exe
You should see a nice prompt showing a happy IronRuby interpreter running.
Conclusion
The process to get IronRuby on the Mac under Mono is pretty straightforward and will likely get easier. The key for me getting this to work was how great the community is around IronRuby. The members of the IronRuby-Core mailing list do such a great job.
RE: IronRuby, Mono and My Mac
You’ve been kicked (a good thing) – Trackback from DotNetKicks.com
RE: IronRuby, Mono and My Mac
You’ve been kicked (a good thing) – Trackback from DotNetKicks.com