3. Getting RubyCocoa
3.1 RubyCocoa Home Page
The home for RubyCocoa development is hosted
at sourceforge.net.
Look there for the latest news and releases.
3.2 Downloading and Installing RubyCocoa
RubyCocoa distributions are downloadable from this page on SourceForge.
The current version is 0.13 (released November 24, 2007). It’s a universal binary that works great on Intel iMacs and Mac Books. If you’re using the Apple-installed ruby (the one at /usr/bin/ruby), then you probably want to download and install the disk image—it’s the file whose name ends in ”.dmg”. After downloading it, double click on it and the installation will begin.
If you have built a newer version of ruby and installed it somewhere else (probably /usr/local/bin/ruby), then you’ll need to instead download the source code distribution and build RubyCocoa yourself. To do so, download the file ending in ”.tgz”. To build, simply run the following in the unpacked directory:ruby install.rb config ruby install.rb setup sudo ruby install.rb install
3.3 Building and Installing RubyCocoa from Subversion
To keep up with the latest developments and bug fixes, you can download and build RubyCocoa directly from the subversion repository. The latest versions of RubyCocoa can be checked out with the following subversion command:
svn co https://rubycocoa.svn.sourceforge.net/svnroot/rubycocoa/trunk rubycocoaRecently (Fall 2006), there have been a lot of bleeding-edge changes on a branch that you can check out with this:
svn co https://rubycocoa.svn.sourceforge.net/svnroot/rubycocoa/branches/apple-unstable rubycocoaIf you get an error message like the following, you probably are running with an old version of subversion:
% svn co https://rubycocoa.svn.sourceforge.net/svnroot/rubycocoa/trunk rubycocoa svn: SSL is not supported
Download and install a new subversion client from Matthew Porter’s archive on metissian.com. Be sure to use version 1.3.1 or later to get a universal binary and SSL support.
3.4 Building and Installing RubyCocoa from CVS (obsolete)
The RubyCocoa development team has switched from CVS to Subversion. The CVS archive has been abandoned for new development.
To get RubyCocoa sources from CVS, first log into the sourceforge CVS server with the following command:cvs -d:pserver:anonymous@rubycocoa.cvs.sourceforge.net:/cvsroot/rubycocoa login
If you are prompted for a password, just press return. Then use the following command to download the sources to a “rubycocoa” directory in your current working directory:
cvs -z3 -d:pserver:anonymous@rubycocoa.cvs.sourceforge.net:/cvsroot/rubycocoa co -P rubycocoa
If the above steps fail, check the RubyCocoa CVS information page.
After checking out the sources, you can build RubyCocoa using the steps in the previous section.
Did you find an error? Is something missing? Post your comment or suggestion below!
Comments (17) post
MAKE SURE you install the latest (at least .4.3, as of this writing). The .4.2 binary had bugs on Tiger. Do not be mislead by the “news” on the front page, none of those releases have working binaries for Tiger. Stick with the version mentioned on this page.
It’s really best to build directly from the Subversion archives. A lot has changed since the last release, and until the next one (which appears to be coming soon), you’ll want all the improvements that Laurent and others have made.
Nice tutorial, thank you!
I took your advice and checked out the latest sources from the SVN repository. However, the “ruby install.rb setup” step fails. Unfortunately, I did the “sudo ruby install.rb install” step before noticing. Anyways, it would be helpful if there was a pointer to an uninstall or upgrade guide. If I get through it in one piece, I’ll send it to you.
Thanks again!
I also can’t install from the svn repository. I get an error during install.rb setup:
Ld /Users/nkallen/Desktop/rubycocoa-0.5.0.1/rubycocoa/src/framework/build/Default/RubyCocoa.framework/Versions/A/RubyCocoa normal i386 cd /Users/nkallen/Desktop/rubycocoa-0.5.0.1/rubycocoa/src/framework /usr/bin/gcc-4.0 -o /Users/nkallen/Desktop/rubycocoa-0.5.0.1/rubycocoa/src/framework/build/Default/RubyCocoa.framework/Versions/A/RubyCocoa -L/Users/nkallen/Desktop/rubycocoa-0.5.0.1/rubycocoa/src/framework/build/Default -L/usr/local/lib -F/Users/nkallen/Desktop/rubycocoa-0.5.0.1/rubycocoa/src/framework/build/Default -filelist /Users/nkallen/Desktop/rubycocoa-0.5.0.1/rubycocoa/src/framework/build/RubyCocoa.build/Default/RubyCocoa.build/Objects-normal/i386/RubyCocoa.LinkFileList -framework Cocoa -framework QTKit -arch i386 -compatibility_version 1 -current_version 1 -install_name @executable_path/../Frameworks/RubyCocoa.framework/Versions/A/RubyCocoa -Wl,-Y,1455 -dynamiclib -mmacosx-version-min=10.3 -flat_namespace -lxml2 /usr/local/lib/libruby-static.a ld: Undefined symbols: _environ /usr/local/lib/libruby-static.a(ruby.o) reference to undefined _environ /usr/bin/libtool: internal link edit command failedHi Nick,
It seems that you are installing 0.5.0.1. What’s your version of Ruby?
I get the following error, I built ruby 1.8.4 using the hivelogic instructions. Rubycocoa checkedout from subversion (revision 1414)
%ruby install.rb config
install.rb: entering config phase… config failed
hook /Users/joachimm/rubycocoa-unstable/./pre-config.rb failed:
ERROR: ruby must be built as a shared library
try ‘ruby install.rb—help’ for usage
I’m getting the same error messages as Nick. I check the src out from subversion and I’m running ruby 1.8.4
solved my problem by recompiling ruby as—enable-shared
Nick,
Did you solve your install problem? I got the same Undefined symbol: _environ error when executing setup with the svn version.
Anyone else found a fix? I have not tried v 0.5. Should I use this instead?
Regards.
If you’ve grabbed ruby from darwinports you can also get rubycocoa from there.
sudo port install rb-cocoa
Nick, Stephen
Upgrading to ruby 1.8.5 fixed the problem for me.
On OSX:
I complied ruby 1.8.5 (2006-12-25 patchlevel 12) [powerpc-darwin8.8.0] with these flags:
./configure—prefix=/usr/local—enable-pthread—with-readline-dir=/usr/local—enable-shared
And then rubycocoa 0.10.1 with:
ruby install.rb config—prefix=/usr/local/
to get everything to work… :)
Great! Thank you
The svn url is now slight different. It worked for me with the following rep:
svn co https://svn.sourceforge.net/svnroot/rubycocoa/trunk rubycocoa
Actually, the correct svn url seems to be:
svn co https://rubycocoa.svn.sourceforge.net/svnroot/rubycocoa rubycocoa .
Sorry, forgot to add trunk at the end of the URL:
svn co https://rubycocoa.svn.sourceforge.net/svnroot/rubycocoa/trunk rubycocoa
There is another (and easy) way to install it: using the macports ;)
I’m really enjoing your tutorial, thanks!
Did I fail to follow an instruction, or is there a problem with the build script? Per the instructions on page 4, ...
irb(main):001:0> require ‘osx/cocoa’ LoadError: Failed to load /usr/local/lib/ruby/site_ruby/1.8/universal-darwin8.0/rubycocoa.bundle
H’mm, now why would that be?
Quetzalcoatl:/usr/local/lib/ruby/site_ruby/1.8/universal-darwin8.0 # file rubycocoa.bundle rubycocoa.bundle: Mach-O bundle i386 Quetzalcoatl:/usr/local/lib/ruby/site_ruby/1.8/universal-darwin8.0 #
OK, well, clearly i386 != universal. I’m on a PowerBook. How do I fix this? Other than replacing my machine, I mean.