# Connecting to Oracle from an Intel Mac -- arch. conflicts

**URL:** <https://www.ruby-forum.com/t/connecting-to-oracle-from-an-intel-mac-arch-conflicts/120196>\
**Category:** Rails\
**Created:** [November 14, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-an-intel-mac-arch-conflicts/120196 "2007-11-14T18:08:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bcm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@bcm](https://www.ruby-forum.com/u/bcm)\
**Post date:** [November 14, 2007, 6:08pm UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-an-intel-mac-arch-conflicts/120196/1 "2007-11-14T18:08:56Z")

</div>

Hi all,

I’ve got a rather complex problem on my hands. I’m using Leopard (OSX  
10.5) on an Intel Mac, with the standard Ruby and Rails installations.  
In order to get Rails to talk to Oracle, I upgraded the Rails gems to  
the latest release candidate (1.99), and installed the oracle adapter  
gem. So far so good.

But the Oracle InstantClient is a PPC-only library. You can’t get the  
default Ruby install to talk to it, since on the Intel Mac it always  
runs in native mode, not in Rosetta. So to get around that I used ditto  
to extract the PPC version of the Ruby binary. In /usr/bin I’ve now got  
“ruby\_ppc” and “ruby\_fat” with a ln from “ruby” to “ruby\_ppc” – so from  
anywhere in the system, if you call “ruby” you get the PPC version.  
Believe it or not, this is sufficient to get Rails to talk to Oracle: my  
apps connect to the Oracle database, and it’s all good.

Until I use the console. Running script/console brings up the console  
just fine, and I can use the model classes in my app that aren’t pulling  
from Oracle, but if I try to use one that needs Oracle, I get the  
following error:

LoadError: Oracle/OCI libraries could not be loaded:  
dlopen(/Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle, 9): no  
suitable image found. Did find:  
/Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle: mach-o,  
but wrong architecture -  
/Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle  
from  
/Library/Ruby/Gems/1.8/gems/activerecord-oracle-adapter-1.0.0/lib/active\_record/connection\_adapters/oracle\_adapter.rb:713:in  
`oracle_connection' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:291:in`send’  
from  
/Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:291:in  
`connection=' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/connection_adapters/abstract/connection_specification.rb:259:in`retrieve\_connection’  
from  
/Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active\_record/connection\_adapters/abstract/connection\_specification.rb:78:in  
`connection' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:2222:in`quoted\_table\_name’  
from  
/Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active\_record/base.rb:1155:in  
`construct_finder_sql' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:1035:in`find\_every’  
from  
/Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active\_record/base.rb:1029:in  
`find_initial' from /Library/Ruby/Gems/1.8/gems/activerecord-1.99.0/lib/active_record/base.rb:437:in`find’  
from (irb):3

The bundle in question,  
/Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle, shows as  
Mach-O ppc, which is what it should be. The ruby binary is also Mach-O  
ppc. They match.

Why is it that the console isn’t working, but my Rails apps are?

Please help!

Thanks.

Brent

---

<div class="post-metadata">

**Author:** ![bcm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@bcm](https://www.ruby-forum.com/u/bcm)\
**Post date:** [November 18, 2007, 10:30am UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-an-intel-mac-arch-conflicts/120196/2 "2007-11-18T10:30:29Z")

</div>

On 14.11.2007, at 18:08, Brent M. wrote:

> The bundle in question,  
> /Library/Ruby/Site/1.8/universal-darwin9.0/oci8lib.bundle, shows as  
> Mach-O ppc, which is what it should be. The ruby binary is also  
> Mach-O  
> ppc. They match.
> 
> Why is it that the console isn’t working, but my Rails apps are?

console is running inside irb, not ruby. You probably need to perform  
the same trick with irb executable as you did with ruby.

izidor

P.S. It is a useful trick to know…

---

<div class="post-metadata">

**Author:** ![bcm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@bcm](https://www.ruby-forum.com/u/bcm)\
**Post date:** [November 19, 2007, 6:23pm UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-an-intel-mac-arch-conflicts/120196/3 "2007-11-19T18:23:07Z")

</div>

Thanks Izidor. :+) You put me on the right track. It seems that in  
Leopard, there are 2 ruby binaries – one lives in the Ruby Framework in  
/Library/blahblahblah. If I extract a ppc only version of that binary,  
everything works great.

thanks again!

Brent

> console is running inside irb, not ruby. You probably need to perform  
> the same trick with irb executable as you did with ruby.
> 
> izidor
> 
> P.S. It is a useful trick to know…

---

<div class="post-metadata">

**Author:** ![bcm](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/977dab/32.png) [@bcm](https://www.ruby-forum.com/u/bcm)\
**Post date:** [November 20, 2007, 9:06am UTC](https://www.ruby-forum.com/t/connecting-to-oracle-from-an-intel-mac-arch-conflicts/120196/4 "2007-11-20T09:06:50Z")

</div>

Happy to see your problems are solved.

But for the archives:

By default there is only one ruby binary in Leopard - the one that  
lives in /System/Library/Frameworks/Ruby.framework/Versions/Current/  
usr/bin/ruby.  
The file /usr/bin/ruby is only a symlink to the canonical executable:

g5:~\> ls -l `which ruby`  
lrwxr-xr-x 1 root wheel 76 26 okt 23:15 /usr/bin/ruby -\> …/…/  
System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby

The canonical file in /System/Library is the executable which needs to  
be manipulated. It seems that on your system you had some other ruby  
installed besides the original Leopard version.

And about irb: irb is a symlink to /System/Library script which is  
executed by the canonical ruby directly (not via the /usr/bin/ruby,  
but hardcoded /System/Library/blabla), so if you have some custom  
version of ruby in /usr/bin, you also need to provide the  
corresponding irb (and others, probably)…

izidor
