Thanks for all the help Laurent. Here are the results: Both of the following print "1":
$ macruby -e "p NSBundle.bundleWithPath('/System/Library/Frameworks/Cocoa.framework').loadAndReturnError(nil)" $ macruby -e "p NSBundle.bundleWithPath('/System/Library/Frameworks/Cocoa.framework').load" Trying to load Foundation with $ macruby -e "framework 'Foundation'" worked. And as for the directories ~/Library/Frameworks - Doesn't exist /Library/Frameworks - Doesn't contain Cocoa.framework /System/Library/Frameworks - Cocoa.framework is in here The only other places I could find Cocoa.framework is in: /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/ /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/ Urgh! I was just about to send this email and though I'd try framework 'Cocoa' again to see the error it produced and guess what, it worked! So I closed the macirb process and fired it up again to check once more and it failed with the same error as earlier. :'( I'm having major trouble building and running MacRuby apps from Xcode as well, although I expect that is down to the same issue? Sometimes it builds and sometimes it fails with things like: Program received signal: “EXC_BAD_INSTRUCTION”. and Program received signal: “EXC_BAD_ACCESS”. sharedlibrary apply-load-rules all No memory available to program now: unsafe to call malloc Unable to restore previously selected frame: Unable to restore previously selected frame: Unable to restore previously selected frame: Unable to restore previously selected frame: Unable to restore previously selected frame: Unable to restore previously selected frame: Unable to restore previously selected frame: Cannot access memory at address 0x9a41 Cannot access memory at address 0x9a41 Alistair 2009/8/30 Laurent Sansonetti <lsansone...@apple.com> > Also, could you confirm that it also fails for other frameworks? > > macruby -e "framework 'Foundation'" > > If this works, then I suspect MacRuby finds a Cocoa.framework somewhere in > your disk that is not the right one. > > In case you pass a string (ex. foo) to #framework, it will search for > foo.framework in the following locations (in this order): > > ~/Library/Frameworks > /Library/Frameworks > /System/Library/Frameworks > > Can you double-check in the 2 first directories that there is nothing wrong > there? > > Laurent > > > On Aug 29, 2009, at 8:11 PM, Laurent Sansonetti wrote: > > Hi Alistair, >> >> So, looking at the error you pasted earlier, it seems that it's raised in >> the following objc.m logic: >> >> if (![bundle loadAndReturnError:&error]) { >> rb_raise(rb_eRuntimeError, >> "framework at path `%s' cannot be loaded: %s", >> cstr, >> [[error description] UTF8String]); >> } >> >> In other words, -[NSBundle loadAndReturnError:] doesn't seem to work. This >> looks like a problem in Foundation. >> >> Could you try the following snippets? >> >> $ macruby -e "p >> NSBundle.bundleWithPath('/System/Library/Frameworks/Cocoa.framework').loadAndReturnError(nil)" >> $ macruby -e "p >> NSBundle.bundleWithPath('/System/Library/Frameworks/Cocoa.framework').load" >> >> In my environment both print "1". >> >> Laurent >> >> On Aug 29, 2009, at 2:14 PM, Alistair Holt wrote: >> >> Does anyone have any ideas on this? It's driving me mad not being able to >>> use MacRuby on my MBP. I really don't want to have to try doing something >>> like a clean system install. >>> >>> BTW - I installed MacRuby the same way on my MP and have had no problems >>> with it at all. >>> >>> Alistair >>> >>> >>> 2009/8/29 Alistair Holt <alistairh...@gmail.com> >>> I've just upgraded to Snow Leopard and installed again from trunk but I'm >>> still having the same issue with not being able to load the Cocoa framework >>> in macirb. :( >>> >>> Alistair >>> >>> 2009/8/26 Alistair Holt <alistairh...@gmail.com> >>> >>> Perhaps I'll give installing another go. I did install 0.4 and went onto >>> install from trunk afterwards but neither worked at the time. I'll let you >>> know what happens. >>> >>> Alistair >>> >>> 2009/8/26 Matt Aimonetti <mattaimone...@gmail.com> >>> >>> I had the same problem occuring a few days ago, after reinstalling >>> macruby trunk today, everything is back to normal. >>> >>> - Matt >>> >>> >>> On Mon, Aug 24, 2009 at 2:38 AM, Alistair Holt <alistairh...@gmail.com> >>> wrote: >>> Hi Laurent, >>> >>> Thanks for the reply. I ran it and got: >>> >>> ~ $ macruby -e "framework '/System/Library/Frameworks/Cocoa.framework'; p >>> :ok" >>> :ok >>> >>> My filesystem is definitely not case sensitive. >>> >>> Alistair Holt >>> >>> >>> 2009/8/24 Laurent Sansonetti <lsansone...@apple.com> >>> >>> Hi Alistair, >>> >>> This is very strange... could you try the following command? >>> >>> $ macruby -e "framework '/System/Library/Frameworks/Cocoa.framework'; p >>> :ok" >>> >>> Also, maybe your filesystem is case sensitive? The default format is case >>> insensitive, in theory. >>> >>> Laurent >>> >>> >>> On Aug 23, 2009, at 8:42 AM, Alistair Holt wrote: >>> >>> Hello, >>> >>> I've just installed MacRuby (MacRuby version 0.4 (ruby 1.9.1) >>> [universal-darwin9.5, x86_64]) via the package I downloaded from >>> http://www.macruby.org and I dropped straight into macirb to start on >>> the tutorial (http://www.macruby.org/documentation/tutorial.html). I ran >>> framwork 'Cocoa' and uh oh.. a RuntimeError popped up. >>> >>> I've seen another thread on this list from January with the same issue >>> but there wasn't really any fix detailed. I've posted my console output of >>> lots of different commands at >>> https://gist.github.com/359195517cc2364b82b8. >>> >>> I'm running 10.5.8 on a MacBook Pro 2.4Ghz Intel Core 2 Duo. Hard disk >>> format is Mac OS Extended (Journaled). >>> >>> Hopefully someone can help me out. >>> >>> Thanks >>> >>> Alistair Holt >>> >>> E: alistairh...@gmail.com >>> W: koopd.com / http://www.linkedin.com/in/alistairholt >>> >>> _______________________________________________ >>> MacRuby-devel mailing list >>> MacRuby-devel@lists.macosforge.org >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >>> _______________________________________________ >>> MacRuby-devel mailing list >>> MacRuby-devel@lists.macosforge.org >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >>> >>> _______________________________________________ >>> MacRuby-devel mailing list >>> MacRuby-devel@lists.macosforge.org >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >>> >>> >>> _______________________________________________ >>> MacRuby-devel mailing list >>> MacRuby-devel@lists.macosforge.org >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >>> >>> >>> >>> _______________________________________________ >>> MacRuby-devel mailing list >>> MacRuby-devel@lists.macosforge.org >>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >>> >> >> _______________________________________________ >> MacRuby-devel mailing list >> MacRuby-devel@lists.macosforge.org >> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >> > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel >
_______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel