Ruby 1.8.1 on OS X Panther and RubyCocoa

P

Phil Tomson

Being new to OS X (about 2 weeks now).

What's the best way to upgrade from the included Ruby (1.6.8) to
1.8.1?

A couple of other questions:

1. I want to use RubyCocoa; are there any issues if I upgrade to
1.8.1?
2. In the future it would be cool to be able to release my RubyCocoa
creations into the OS X wild (even to non-Ruby users). Is there any
way currently to package a RubyCocoa app so that anyone who downloads
it can just run it without having to go and get the RubyCocoa libs?

I guess it would be nice if Apple included RubyCocoa libs with their
next release of OS X, that would make #2 easy. It seems like there
are a couple of ways to achieve this:
1) We include RubyCocoa in the standard Ruby release (of course it
wouldn't get compiled on Windows platforms, but it could potentially
work with GNUStep on Linux) as another GUI lib (like we include FOX
and TK support now).
2) We lobby Apple to include RubyCocoa in OS X 10.4

#1 pros: we as a community have more control over it and it allows
people to (potentially) create Cocoa apps that run on both OS X and
Linux (GNUStep) platforms. Of course, I suspect the full API isn't
available on Linux (like the AddressBook API for example). However,
#1 would also add a lot of code to the standard Ruby distribution that
would primarily benefit only one platform, so it may not be a good
option.

Pehaps there is another option:
3) Those of us in the Ruby community who use OS X (seems to be a
growing number) create a distribution of Ruby for OS X that includes
RubyCocoa and try to get Apple to include it in 10.4. This would be
kind of like the Windows version of Ruby.

It's great to have Ruby included on OS X, but it would be even better
if we could write Cocoa apps with it right out of the box. Is anyone
at Apple listening?

Phil
 
G

Gavin Kistner

What's the best way to upgrade from the included Ruby (1.6.8) to
1.8.1?

Personally, I downloaded the source, built it, let it install in the
standard location (/usr/local/) and added that to my path.

I think I also hunted down old copies and deleted them from their
standard-install locations.

Dunno, though...what are your parameters for 'best'?

I also trashed the built-in apache and built my own (again in the
standard dir) along with postgresql and mod_ruby and eruby and
ruby/postgres and more. The non-best aspect of this was that the
Sharing pane in System Preferences no longer allows me to start/stop
apache. The upside is that just about everything installed fine without
having to point out specific directories.
 
M

Mark Hubbart

Being new to OS X (about 2 weeks now).

What's the best way to upgrade from the included Ruby (1.6.8) to
1.8.1?

I tried a few different ways; for me the best way was to configure ruby
to install into /usr/local. This lets me keep the system version of
ruby around, and makes it so that I don't have to reinstall the newer
version of ruby when I upgrade the OS.
1. I want to use RubyCocoa; are there any issues if I upgrade to
1.8.1?

(Disclaimer! I didn't work with it a whole lot, but did read the docs.)
IIRC: applications built with Ruby v1.8 may not run properly on systems
running Ruby v1.6.
2. In the future it would be cool to be able to release my RubyCocoa
creations into the OS X wild (even to non-Ruby users). Is there any
way currently to package a RubyCocoa app so that anyone who downloads
it can just run it without having to go and get the RubyCocoa libs?

There are two types of applications that you can make with RubyCocoa.
One is a standard ruby script that includes the extensions that link to
the framework. The other is a bundled app that you produce using
Apple's XCode. If you go with the bundled app, the framework can be
bundled up inside the app and noone will need to know that you even
used Ruby in the app :) If you distribute a script, OTOH, you will need
to provide the framework and compiled extensions.
I guess it would be nice if Apple included RubyCocoa libs with their
next release of OS X, that would make #2 easy. It seems like there
are a couple of ways to achieve this:
1) We include RubyCocoa in the standard Ruby release (of course it
wouldn't get compiled on Windows platforms, but it could potentially
work with GNUStep on Linux) as another GUI lib (like we include FOX
and TK support now).
2) We lobby Apple to include RubyCocoa in OS X 10.4

Personally, I really, REALLY think that Apple should maintain it. I
think all the bridge projects are open-sourced, so they could make
their own version of it. If they made RubyCocoa and it's sisters
(CamelBones and PyObjC) as easy to use as the Java-ObjectiveC Bridge, I
think there would be a lot more mac developers :) Seeing how many apps
there are now that were written using the java bridge, I'm sure that a
really good interface to the major "scripting" languages would result
in tons of new or ported apps. I know I would be developing more.

Unfortunately, Apple isn't maintaining them, and RubyCocoa, which was
written by a very busy person, hasn't had any major updates in a while
(that I know of) and last time I tried to install it (on panther) i
found it to be too much trouble. If I knew ObjectiveC, I would try to
help the project; but I don't.
It's great to have Ruby included on OS X, but it would be even better
if we could write Cocoa apps with it right out of the box. Is anyone
at Apple listening?

I hope so... :)

--Mark
 
M

Mark Hubbart

Personally, I downloaded the source, built it, let it install in the
standard location (/usr/local/) and added that to my path.

I think I also hunted down old copies and deleted them from their
standard-install locations.

Dunno, though...what are your parameters for 'best'?

I also trashed the built-in apache and built my own (again in the
standard dir) along with postgresql and mod_ruby and eruby and
ruby/postgres and more. The non-best aspect of this was that the
Sharing pane in System Preferences no longer allows me to start/stop
apache.

I believe you can solve this by editing the apache startup item to run
your new apache. I did this when I was running fink's apache; just look
in /System/Libray/StartupItems/Apache... there's a script in there.
change the paths in it, and you *should* be good to go. You may have to
change the $PATH environment variable too, though. Can't quite remember
for sure.

I wouldn't, though, trash the originals. when you update the system,
they might just go right back in anyways, or worse, just parts of them.
Also, you might want to be able to test something on the default setup,
to make sure it'll run properly for Joe User, who doesn't know how to
upgrade like that, and wouldn't want to anyhow. :)

--Mark
 
M

Mark Wilson

Being new to OS X (about 2 weeks now).

What's the best way to upgrade from the included Ruby (1.6.8) to
1.8.1?

A couple of other questions:

1. I want to use RubyCocoa; are there any issues if I upgrade to
1.8.1?
2. In the future it would be cool to be able to release my RubyCocoa
creations into the OS X wild (even to non-Ruby users). Is there any
way currently to package a RubyCocoa app so that anyone who downloads
it can just run it without having to go and get the RubyCocoa libs?

[snip]

DarwinPorts has a fair amount of Ruby stuff (including RubyCocoa).
There's a fair amount there and, of course, a lot more that could be
done (I myself don't have the competence or the time to contribute in
the near future). Here's a link:

http://darwinports.opendarwin.org/ports/?by=cat&substr=ruby

Regards,

Mark Wilson
 
P

Phil Tomson

I tried a few different ways; for me the best way was to configure ruby
to install into /usr/local. This lets me keep the system version of
ruby around, and makes it so that I don't have to reinstall the newer
version of ruby when I upgrade the OS.


(Disclaimer! I didn't work with it a whole lot, but did read the docs.)
IIRC: applications built with Ruby v1.8 may not run properly on systems
running Ruby v1.6.

I would expect that your RubyCocoa bindings would need to be built with
the version of Ruby you're using - is that what you mean?
There are two types of applications that you can make with RubyCocoa.
One is a standard ruby script that includes the extensions that link to
the framework. The other is a bundled app that you produce using
Apple's XCode. If you go with the bundled app, the framework can be
bundled up inside the app and noone will need to know that you even
used Ruby in the app :) If you distribute a script, OTOH, you will need
to provide the framework and compiled extensions.

Can you give some more details about the second option? How does one go
about doing this? (a quick HOWTO?)


Phil
 
P

Phil Tomson

Being new to OS X (about 2 weeks now).

What's the best way to upgrade from the included Ruby (1.6.8) to
1.8.1?

A couple of other questions:

1. I want to use RubyCocoa; are there any issues if I upgrade to
1.8.1?
2. In the future it would be cool to be able to release my RubyCocoa
creations into the OS X wild (even to non-Ruby users). Is there any
way currently to package a RubyCocoa app so that anyone who downloads
it can just run it without having to go and get the RubyCocoa libs?

[snip]

DarwinPorts has a fair amount of Ruby stuff (including RubyCocoa).
There's a fair amount there and, of course, a lot more that could be
done (I myself don't have the competence or the time to contribute in
the near future). Here's a link:

http://darwinports.opendarwin.org/ports/?by=cat&substr=ruby

Pardon my ignorance, but how does one use these ports?

Phil
 
M

Mark Hubbart

I would expect that your RubyCocoa bindings would need to be built with
the version of Ruby you're using - is that what you mean?

yeah. I'm nearly positive that if you build RubyCocoa against a certain
version of Ruby, that's what you have to use with it from then on.
That's one reason why I would advise against deleting the original
distribution; that's the one that your users will have.
Can you give some more details about the second option? How does one
go
about doing this? (a quick HOWTO?)

There should be project templates (for Project Builder / XCode) that
you can install with the framework... You build the app using XCode and
Interface Builder, mostly like a Java-Cocoa app. Compile it in XCode,
and it will build the application, and by default (I think) it includes
the framework in the app bundle. The app that you get should look and
act just like any other mac app.

--Mark
 
O

Ollivier Robert

[courtesy cc of this posting sent to cited author via email]

Pardon my ignorance, but how does one use these ports?

[about DarwinPorts]

The best way is to get the tree with anonymous CVS as described on
<http://darwinports.opendarwin.org/>, build the "port" command.

Then installing a port is as easy as "port install ruby".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top