# Building 1.9.1 as universal binary on OS X

**URL:** <https://www.ruby-forum.com/t/building-1-9-1-as-universal-binary-on-os-x/159568>\
**Category:** Ruby\
**Created:** [February 5, 2009, 9:35pm UTC](https://www.ruby-forum.com/t/building-1-9-1-as-universal-binary-on-os-x/159568 "2009-02-05T21:35:40Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![absolute-beginner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@absolute-beginner](https://www.ruby-forum.com/u/absolute-beginner)\
**Post date:** [February 5, 2009, 9:35pm UTC](https://www.ruby-forum.com/t/building-1-9-1-as-universal-binary-on-os-x/159568/1 "2009-02-05T21:35:40Z")

</div>

Hi

I’d like to build the recently released Ruby 1.9.1 as a universal binary  
on OS X. I’m on an Intel 10.5, but want the ruby to be runnable on 10.4  
or 10.5, Intel or PPC.

Following this tech note and advice:

> **[Technotes | Apple Developer Documentation](https://developer.apple.com/documentation/technotes)**
>
> Learn about specific development topics through these in-depth technical articles.

[http://lists.apple.com/archives/Xcode-users/2007/Oct/msg00686.html](http://lists.apple.com/archives/Xcode-users/2007/Oct/msg00686.html)

I did:

Abaddon:ruby-1.9.1-p0 alex$ export CFLAGS=“-O3 -g -isysroot  
/Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc  
-mmacosx-version-min=10.4”  
Abaddon:ruby-1.9.1-p0 alex$ export LDFLAGS=“-arch i386 -arch ppc”  
Abaddon:ruby-1.9.1-p0 alex$ ./configure --prefix=~/bleed

However, the resultant ruby isn’t marked as universal:

Abaddon:ruby-1.9.1-p0 alex$ ~/bleed/bin/ruby -v  
ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9.6.0]  
^^^^^^^^^^^^^^^^  
Unlike the standard 10.5 install of ruby 1.8.6:

Abaddon:~ alex$ ruby -v  
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]  
^^^^^^^^^^^^^^^^^^^  
Can anyone offer any advice here please?

alex

---

<div class="post-metadata">

**Author:** ![absolute-beginner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@absolute-beginner](https://www.ruby-forum.com/u/absolute-beginner)\
**Post date:** [February 6, 2009, 12:40am UTC](https://www.ruby-forum.com/t/building-1-9-1-as-universal-binary-on-os-x/159568/2 "2009-02-06T00:40:57Z")

</div>

Alex F. wrote:

> Abaddon:ruby-1.9.1-p0 alex$ export CFLAGS="-O3 -g -isysroot  
> /Developer/SDKs/MacOSX10.4u.sdk -arch i386 -arch ppc  
> -mmacosx-version-min=10.4"  
> Abaddon:ruby-1.9.1-p0 alex$ export LDFLAGS="-arch i386 -arch ppc"  
> Abaddon:ruby-1.9.1-p0 alex$ ./configure --prefix=~/bleed
> 
> However, the resultant ruby isn’t marked as universal:
> 
> Abaddon:ruby-1.9.1-p0 alex$ ~/bleed/bin/ruby -v  
> ruby 1.9.1p0 (2009-01-30 revision 21907) [i386-darwin9.6.0]  
> ^^^^^^^^^^^^^^^^  
> Unlike the standard 10.5 install of ruby 1.8.6:
> 
> Abaddon:~ alex$ ruby -v  
> ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]  
> ^^^^^^^^^^^^^^^^^^^  
> Can anyone offer any advice here please?
> 
> alex

More importantly, what’s the output of these commands?  
$ file ~/bleed/bin/ruby  
$ file ~/bleed/lib/libruby.1.9.1.dylib

---

<div class="post-metadata">

**Author:** ![absolute-beginner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@absolute-beginner](https://www.ruby-forum.com/u/absolute-beginner)\
**Post date:** [February 6, 2009, 1:30am UTC](https://www.ruby-forum.com/t/building-1-9-1-as-universal-binary-on-os-x/159568/3 "2009-02-06T01:30:51Z")

</div>

Adam G. wrote:

> More importantly, what’s the output of these commands?  
> $ file ~/bleed/bin/ruby  
> $ file ~/bleed/lib/libruby.1.9.1.dylib

Abaddon:ruby-1.9.1-p0 alex$ file ~/bleed/bin/ruby  
/Users/alex/bleed/bin/ruby: Mach-O universal binary with 2 architectures  
/Users/alex/bleed/bin/ruby (for architecture i386): Mach-O executable  
i386  
/Users/alex/bleed/bin/ruby (for architecture ppc): Mach-O executable  
ppc  
Abaddon:ruby-1.9.1-p0 alex$ file ~/bleed/lib/libruby-static.a  
/Users/alex/bleed/lib/libruby-static.a: Mach-O universal binary with 2  
architectures  
/Users/alex/bleed/lib/libruby-static.a (for architecture i386): current  
ar archive random library  
/Users/alex/bleed/lib/libruby-static.a (for architecture ppc): current  
ar archive random library

alex

---

<div class="post-metadata">

**Author:** ![absolute-beginner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@absolute-beginner](https://www.ruby-forum.com/u/absolute-beginner)\
**Post date:** [February 6, 2009, 5:18am UTC](https://www.ruby-forum.com/t/building-1-9-1-as-universal-binary-on-os-x/159568/4 "2009-02-06T05:18:22Z")

</div>

Hi,

At Fri, 6 Feb 2009 05:34:27 +0900,  
Alex F. wrote in [ruby-talk:327034]:

> I’d like to build the recently released Ruby 1.9.1 as a universal binary  
> on OS X. I’m on an Intel 10.5, but want the ruby to be runnable on 10.4  
> or 10.5, Intel or PPC.

Universal binary support was very incomplete and has been dropped.  
Not only it’d confused autoconf and fallen into disaster, x86 and ppc  
platforms behave differently in some points.

> Abaddon:ruby-1.9.1-p0 alex$ ./configure --prefix=~/bleed  
> Do NOT use -arch option multiple times.

Instead, build for each archs and bind them with lipo command.

---

<div class="post-metadata">

**Author:** ![absolute-beginner](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a5b964/32.png) [@absolute-beginner](https://www.ruby-forum.com/u/absolute-beginner)\
**Post date:** [February 20, 2009, 11:10pm UTC](https://www.ruby-forum.com/t/building-1-9-1-as-universal-binary-on-os-x/159568/5 "2009-02-20T23:10:07Z")

</div>

Alex F. wrote:

> Adam G. wrote:
> 
> > More importantly, what’s the output of these commands?  
> > $ file ~/bleed/bin/ruby  
> > $ file ~/bleed/lib/libruby.1.9.1.dylib
> 
> Abaddon:ruby-1.9.1-p0 alex$ file ~/bleed/bin/ruby  
> /Users/alex/bleed/bin/ruby: Mach-O universal binary with 2 architectures  
> /Users/alex/bleed/bin/ruby (for architecture i386): Mach-O executable  
> i386  
> /Users/alex/bleed/bin/ruby (for architecture ppc): Mach-O executable  
> ppc  
> Abaddon:ruby-1.9.1-p0 alex$ file ~/bleed/lib/libruby-static.a  
> /Users/alex/bleed/lib/libruby-static.a: Mach-O universal binary with 2  
> architectures  
> /Users/alex/bleed/lib/libruby-static.a (for architecture i386): current  
> ar archive random library  
> /Users/alex/bleed/lib/libruby-static.a (for architecture ppc): current  
> ar archive random library
> 
> alex

Sorry, it took me so long to respond to this. If the ‘file’ command  
reports that it’s a Mach-O universal binary with 2 architectures, then  
you _did_ build ruby as universal. Whether it works or not is an open  
question, but it’s a universal binary either way. The ruby version  
string (in particular, the ‘i386-darwin9.0’ bit) is just an  
informational text string stored in rbconfig.rb, generated at some point  
during the build process. You could open rbconfig.rb and change the  
platform string to ‘my-little-pony’ and it probably wouldn’t change a  
thing (until you try to run a script that checks that value to determine  
what platform-specific code to run, I guess).

- Adam
