# Building Ruby extensions on OS X Tiger

**URL:** <https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015>\
**Category:** ruby-talk\
**Created:** [30 April 2005 00:35 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015 "2005-04-30T00:35:22Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rich\_Kilmer](https://avatars.discourse-cdn.com/v4/letter/r/85f322/32.png) [@Rich\_Kilmer](https://rubytalk.org/u/Rich_Kilmer)\
**Post date:** [30 April 2005 00:35 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/1 "2005-04-30T00:35:22Z")

</div>

Tony Arnold posted this on the Rails wiki:

> **···**
>
> \_\_\_\_\_
> 
> Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However, rbconfig.rb needs to be edited if you want to build any gems. (from Rich...not gems, native extensions)
> 
> Edit rbconfig.rb
> 
> sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb  
> Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
> 
> You will also need to change:  
> CONFIG["LIBRUBYARG\_STATIC"] = "-l$(RUBY\_SO\_NAME)-static"  
> to:  
> CONFIG["LIBRUBYARG\_STATIC"] = ""  
> \_\_\_\_\_
> 
> NOTE: This is only important if you are building native extensions (not pure ruby ones)...but it does suck when you run into it...so its worth fixing.
> 
> Wiki link: [http://wiki.rubyonrails.com/rails/show/HowtoInstallOnOSXTiger](http://wiki.rubyonrails.com/rails/show/HowtoInstallOnOSXTiger)
> 
> Chad is working on a gem that you can install which fixes this too.
> 
> -rich

---

<div class="post-metadata">

**Author:** ![Chad\_Fowler4](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Chad\_Fowler4](https://rubytalk.org/u/Chad_Fowler4)\
**Post date:** [30 April 2005 00:52 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/2 "2005-04-30T00:52:26Z")

</div>

sudo gem install fixrbconfig  
sudo fixrbconfig

> **···**
>
> On 4/29/05, Richard Kilmer \<rich@infoether.com\> wrote:
> 
> > Tony Arnold posted this on the Rails wiki:  
> > \_\_\_\_\_
> > 
> > Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,  
> > rbconfig.rb needs to be edited if you want to build any gems. (from  
> > Rich...not gems, native extensions)
> > 
> > Edit rbconfig.rb
> > 
> > sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb  
> > Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
> > 
> > You will also need to change:  
> > CONFIG["LIBRUBYARG\_STATIC"] = "-l$(RUBY\_SO\_NAME)-static"  
> > to:  
> > CONFIG["LIBRUBYARG\_STATIC"] = ""  
> > \_\_\_\_\_
> > 
> > NOTE: This is only important if you are building native extensions  
> > (not pure ruby ones)...but it does suck when you run into it...so its  
> > worth fixing.
> > 
> > Wiki link: [http://wiki.rubyonrails.com/rails/show/HowtoInstallOnOSXTiger](http://wiki.rubyonrails.com/rails/show/HowtoInstallOnOSXTiger)
> > 
> > Chad is working on a gem that you can install which fixes this too.
> > 
> > -rich
> 
> --
> 
> Chad Fowler  
> [http://chadfowler.com](http://chadfowler.com)
> 
> > **[Ruby Central](https://rubycentral.org)**
> >
> > Supporting the Ruby Community Since 2001
> 
> > **[WebMD - Better information. Better health.](https://www.rubygarden.org/)**
> >
> > The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...
> 
> [http://rubygems.rubyforge.org](http://rubygems.rubyforge.org) (over 300,000 gems served!)

---

<div class="post-metadata">

**Author:** ![Nobuyoshi\_Nakada](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nobuyoshi\_Nakada](https://rubytalk.org/u/Nobuyoshi_Nakada)\
**Post date:** [1 May 2005 00:30 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/3 "2005-05-01T00:30:33Z")

</div>

Hi,

At Sat, 30 Apr 2005 09:35:22 +0900,  
Richard Kilmer wrote in [ruby-talk:140540]:

> Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,  
> rbconfig.rb needs to be edited if you want to build any gems. (from  
> Rich...not gems, native extensions)
> 
> Edit rbconfig.rb
> 
> sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb  
> Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
> 
> You will also need to change:  
> CONFIG["LIBRUBYARG\_STATIC"] = "-l$(RUBY\_SO\_NAME)-static"  
> to:  
> CONFIG["LIBRUBYARG\_STATIC"] = ""  
> \_\_\_\_\_

ARCH\_FLAG should be "-arch ppc" on darwin. As what is it  
defined, and RUBY\_SO\_NAME?

> **···**
>
> --  
> Nobu Nakada

---

<div class="post-metadata">

**Author:** ![Ptkwt](https://avatars.discourse-cdn.com/v4/letter/p/f14d63/32.png) [@Ptkwt](https://rubytalk.org/u/Ptkwt)\
**Post date:** [30 April 2005 01:24 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/4 "2005-04-30T01:24:27Z")

</div>

In article \<a2347a0405042917523d7e18c2@mail.gmail.com\>,

> **···**
>
> Chad Fowler \<chadfowler@gmail.com\> wrote:
> 
> > On 4/29/05, Richard Kilmer \<rich@infoether.com\> wrote:
> > 
> > > Tony Arnold posted this on the Rails wiki:  
> > > \_\_\_\_\_
> > > 
> > > Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,  
> > > rbconfig.rb needs to be edited if you want to build any gems. (from  
> > > Rich...not gems, native extensions)
> > > 
> > > Edit rbconfig.rb
> > > 
> > > sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb  
> > > Now remove -arch i386 from the CFLAGS and LDFLAGS variables.
> > > 
> > > You will also need to change:  
> > > CONFIG["LIBRUBYARG\_STATIC"] = "-l$(RUBY\_SO\_NAME)-static"  
> > > to:  
> > > CONFIG["LIBRUBYARG\_STATIC"] = ""  
> > > \_\_\_\_\_
> > > 
> > > NOTE: This is only important if you are building native extensions  
> > > (not pure ruby ones)...but it does suck when you run into it...so its  
> > > worth fixing.
> > > 
> > > Wiki link: [http://wiki.rubyonrails.com/rails/show/HowtoInstallOnOSXTiger](http://wiki.rubyonrails.com/rails/show/HowtoInstallOnOSXTiger)
> > > 
> > > Chad is working on a gem that you can install which fixes this too.
> > > 
> > > -rich
> > 
> > sudo gem install fixrbconfig  
> > sudo fixrbconfig
> 
> You are indeed on the cutting edge 😉
> 
> Phil

---

<div class="post-metadata">

**Author:** ![Jim\_Freeze2](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@Jim\_Freeze2](https://rubytalk.org/u/Jim_Freeze2)\
**Post date:** [30 April 2005 15:56 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/5 "2005-04-30T15:56:09Z")

</div>

\* Chad Fowler \<chadfowler@gmail.com\> [2005-04-30 09:52:26 +0900]:

[snipped patch instructions]

> sudo gem install fixrbconfig  
> sudo fixrbconfig

You know, it's this kind of tenderfoot gem file that takes  
the machismo out of hacking a few core ruby files.

> **···**
>
> > On 4/29/05, Richard Kilmer \<rich@infoether.com\> wrote:
> 
> --  
> Jim Freeze  
> Code Red. Code Ruby

---

<div class="post-metadata">

**Author:** ![Chad\_Fowler4](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Chad\_Fowler4](https://rubytalk.org/u/Chad_Fowler4)\
**Post date:** [1 May 2005 02:09 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/6 "2005-05-01T02:09:13Z")

</div>

CONFIG["ARCH\_FLAG"] = ""  
&nbsp;&nbsp;CONFIG["RUBY\_SO\_NAME"] = "$(RUBY\_INSTALL\_NAME)"

Should we update the rbconfig.rb again? KirinDave on irc also found  
another problem with the RC\_CFLAGS environment variable causing  
problems with, for example, RubyInline.

I thought I might release another version of my fixer upper gem.

> **···**
>
> On 4/30/05, nobu.nokada@softhome.net \<nobu.nokada@softhome.net\> wrote:
> 
> > Hi,
> > 
> > At Sat, 30 Apr 2005 09:35:22 +0900,  
> > Richard Kilmer wrote in [ruby-talk:140540]:  
> > \> Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,  
> > \> rbconfig.rb needs to be edited if you want to build any gems. (from  
> > \> Rich...not gems, native extensions)  
> > \>  
> > \> Edit rbconfig.rb  
> > \>  
> > \> sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb  
> > \> Now remove -arch i386 from the CFLAGS and LDFLAGS variables.  
> > \>  
> > \> You will also need to change:  
> > \> CONFIG["LIBRUBYARG\_STATIC"] = "-l$(RUBY\_SO\_NAME)-static"  
> > \> to:  
> > \> CONFIG["LIBRUBYARG\_STATIC"] = ""  
> > \> \_\_\_\_\_
> > 
> > ARCH\_FLAG should be "-arch ppc" on darwin. As what is it  
> > defined, and RUBY\_SO\_NAME?
> 
> --
> 
> Chad Fowler  
> [http://chadfowler.com](http://chadfowler.com)
> 
> > **[Ruby Central](https://rubycentral.org)**
> >
> > Supporting the Ruby Community Since 2001
> 
> > **[WebMD - Better information. Better health.](https://www.rubygarden.org/)**
> >
> > The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...
> 
> [http://rubygems.rubyforge.org](http://rubygems.rubyforge.org) (over 300,000 gems served!)

---

<div class="post-metadata">

**Author:** ![Nobuyoshi\_Nakada](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nobuyoshi\_Nakada](https://rubytalk.org/u/Nobuyoshi_Nakada)\
**Post date:** [1 May 2005 02:55 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/7 "2005-05-01T02:55:05Z")

</div>

Hi,

At Sun, 1 May 2005 11:09:13 +0900,  
Chad Fowler wrote in [ruby-talk:140626]:

> \> \> Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,  
> \> \> rbconfig.rb needs to be edited if you want to build any gems. (from  
> \> \> Rich...not gems, native extensions)  
> \> \>  
> \> \> Edit rbconfig.rb  
> \> \>  
> \> \> sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb  
> \> \> Now remove -arch i386 from the CFLAGS and LDFLAGS variables.  
> \> \>  
> \> \> You will also need to change:  
> \> \> CONFIG["LIBRUBYARG\_STATIC"] = "-l$(RUBY\_SO\_NAME)-static"  
> \> \> to:  
> \> \> CONFIG["LIBRUBYARG\_STATIC"] = ""  
> \> \> \_\_\_\_\_  
> \>  
> \> ARCH\_FLAG should be "-arch ppc" on darwin. As what is it  
> \> defined, and RUBY\_SO\_NAME?  
> \>
> 
> &nbsp;&nbsp;CONFIG["ARCH\_FLAG"] = ""

From where has the flag come?

> &nbsp;&nbsp;CONFIG["RUBY\_SO\_NAME"] = "$(RUBY\_INSTALL\_NAME)"

Do you have a problem at linking with the static library?

> Should we update the rbconfig.rb again? KirinDave on irc also found  
> another problem with the RC\_CFLAGS environment variable causing  
> problems with, for example, RubyInline.

For what is RC\_CFLAGS used, and where is it set? I think ruby  
never use it.

> **···**
>
> --  
> Nobu Nakada

---

<div class="post-metadata">

**Author:** ![Chad\_Fowler4](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Chad\_Fowler4](https://rubytalk.org/u/Chad_Fowler4)\
**Post date:** [1 May 2005 18:18 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/8 "2005-05-01T18:18:10Z")

</div>

> Hi,
> 
> At Sun, 1 May 2005 11:09:13 +0900,  
> Chad Fowler wrote in [ruby-talk:140626]:  
> \> \> \> Mac OS X Tiger ships with Ruby 1.8.2 pre-installed. However,  
> \> \> \> rbconfig.rb needs to be edited if you want to build any gems. (from  
> \> \> \> Rich...not gems, native extensions)  
> \> \> \>  
> \> \> \> Edit rbconfig.rb  
> \> \> \>  
> \> \> \> sudo pico -w /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb  
> \> \> \> Now remove -arch i386 from the CFLAGS and LDFLAGS variables.  
> \> \> \>  
> \> \> \> You will also need to change:  
> \> \> \> CONFIG["LIBRUBYARG\_STATIC"] = "-l$(RUBY\_SO\_NAME)-static"  
> \> \> \> to:  
> \> \> \> CONFIG["LIBRUBYARG\_STATIC"] = ""  
> \> \> \> \_\_\_\_\_  
> \> \>  
> \> \> ARCH\_FLAG should be "-arch ppc" on darwin. As what is it  
> \> \> defined, and RUBY\_SO\_NAME?  
> \> \>  
> \>  
> \> CONFIG["ARCH\_FLAG"] = ""
> 
> From where has the flag come?

rbconfig.rb

> \> CONFIG["RUBY\_SO\_NAME"] = "$(RUBY\_INSTALL\_NAME)"
> 
> Do you have a problem at linking with the static library?

Haven't tried it.

> \> Should we update the rbconfig.rb again? KirinDave on irc also found  
> \> another problem with the RC\_CFLAGS environment variable causing  
> \> problems with, for example, RubyInline.
> 
> For what is RC\_CFLAGS used, and where is it set? I think ruby  
> never use it.

$ grep RC\_CFLAG /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb  
&nbsp;&nbsp;  
CONFIG["LDSHARED"] = "cc $(RC\_CFLAGS) -dynamic -bundle -undefined  
suppress -flat\_namespace"  
&nbsp;&nbsp;CONFIG["LIBRUBY\_LDSHARED"] = "cc $(RC\_CFLAGS) -dynamic -bundle  
-undefined suppress -flat\_namespace"

This is looking like a plain error. Maybe a typo? RC\_CFLAGS appears  
to be used in darwin to allow for customized CFLAG settings. Does  
this make sense to anyone? Seems like it should be changed.

> **···**
>
> On 4/30/05, nobu.nokada@softhome.net \<nobu.nokada@softhome.net\> wrote:
> 
> --
> 
> Chad Fowler  
> [http://chadfowler.com](http://chadfowler.com)
> 
> > **[Ruby Central](https://rubycentral.org)**
> >
> > Supporting the Ruby Community Since 2001
> 
> > **[WebMD - Better information. Better health.](https://www.rubygarden.org/)**
> >
> > The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...
> 
> [http://rubygems.rubyforge.org](http://rubygems.rubyforge.org) (over 300,000 gems served!)

---

<div class="post-metadata">

**Author:** ![Nobuyoshi\_Nakada](https://avatars.discourse-cdn.com/v4/letter/n/edb3f5/32.png) [@Nobuyoshi\_Nakada](https://rubytalk.org/u/Nobuyoshi_Nakada)\
**Post date:** [7 May 2005 16:38 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/9 "2005-05-07T16:38:17Z")

</div>

Hi,

At Mon, 2 May 2005 03:18:10 +0900,  
Chad Fowler wrote in [ruby-talk:140661]:

> \> \> CONFIG["ARCH\_FLAG"] = ""  
> \>  
> \> From where has the flag come?
> 
> rbconfig.rb

> This is looking like a plain error. Maybe a typo? RC\_CFLAGS appears  
> to be used in darwin to allow for customized CFLAG settings. Does  
> this make sense to anyone? Seems like it should be changed.

Do you mean they are misconfiguration by Apple, but not a bug  
of configure.in? Sorry for noise.

> **···**
>
> --  
> Nobu Nakada

---

<div class="post-metadata">

**Author:** ![Chad\_Fowler4](https://avatars.discourse-cdn.com/v4/letter/c/9fc29f/32.png) [@Chad\_Fowler4](https://rubytalk.org/u/Chad_Fowler4)\
**Post date:** [1 July 2005 20:04 UTC](https://rubytalk.org/t/building-ruby-extensions-on-os-x-tiger/18015/10 "2005-07-01T20:04:59Z")

</div>

Sorry for the VERY delayed response. It is a misconfiguration by Apple.

> **···**
>
> On 5/7/05, nobu.nokada@softhome.net \<nobu.nokada@softhome.net\> wrote:
> 
> > Hi,
> > 
> > At Mon, 2 May 2005 03:18:10 +0900,  
> > Chad Fowler wrote in [ruby-talk:140661]:  
> > \> \> \> CONFIG["ARCH\_FLAG"] = ""  
> > \> \>  
> > \> \> From where has the flag come?  
> > \>  
> > \> rbconfig.rb
> > 
> > \> This is looking like a plain error. Maybe a typo? RC\_CFLAGS appears  
> > \> to be used in darwin to allow for customized CFLAG settings. Does  
> > \> this make sense to anyone? Seems like it should be changed.
> > 
> > Do you mean they are misconfiguration by Apple, but not a bug  
> > of configure.in? Sorry for noise.
> 
> --  
> Chad Fowler  
> [http://chadfowler.com](http://chadfowler.com)
> 
> > **[Ruby Central](https://rubycentral.org)**
> >
> > Supporting the Ruby Community Since 2001
> 
> > **[WebMD - Better information. Better health.](https://www.rubygarden.org/)**
> >
> > The leading source for trustworthy and timely health and medical news and information. Providing credible health information, supportive community, and educational services by blending award-winning expertise in content, community services, expert...
> 
> [http://rubygems.rubyforge.org](http://rubygems.rubyforge.org) (over 500,000 gems served!)
