# Difficulty with gem install on osX

**URL:** <https://www.ruby-forum.com/t/difficulty-with-gem-install-on-osx/145944>\
**Category:** Rails\
**Created:** [August 15, 2008, 10:45am UTC](https://www.ruby-forum.com/t/difficulty-with-gem-install-on-osx/145944 "2008-08-15T10:45:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [August 15, 2008, 10:45am UTC](https://www.ruby-forum.com/t/difficulty-with-gem-install-on-osx/145944/1 "2008-08-15T10:45:24Z")

</div>

New to the RoR world view and just learning about gems - I’ve hit a  
snag installing two separate gems that I can’t seem to get past with  
one of them.

My environment is osX 10.5.4 on a ppc processor. I have gcc 4.1 (and  
related tools) installed as well as mysql-5.0.51a. ruby --version =\>  
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] and rails  
–version =\> Rails 2.1.0.

My problem has been with the RMagick and MySQL gems, and is related to  
these gems attempting to build for both the ppc and 386 architectures  
via --arch options for both appearing in the gcc command that is  
generated during the install process.

I was able to step around the problem with RMagick by editing the  
options out of the generated makefile, doing the make directly. Not  
too satisfying but it did build, test, and install. No such luck with  
the MySQL gem however.

Any thoughts or suggestions? Where / how is the makefile generated?  
Who decided that I wanted both architectures build for a ppc only  
environment? Is it even possible to build a foreign arch without a  
cross compiler?

thanks in advance  
Rick

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [August 15, 2008, 10:48am UTC](https://www.ruby-forum.com/t/difficulty-with-gem-install-on-osx/145944/2 "2008-08-15T10:48:21Z")

</div>

On Aug 15, 9:40 am, Rick [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Any thoughts or suggestions? Where / how is the makefile generated?  
> Who decided that I wanted both architectures build for a ppc only  
> environment? Is it even possible to build a foreign arch without a  
> cross compiler?

ruby generates the makefile (via extconf.rb, ie mkmf). The problem  
you’ve got is that since you’ve got a universal build of ruby it’s  
trying to build universal extensions.  
See also

> **[Perl, Python, and Ruby Extensions Release Notes](https://developer.apple.com/library/archive/releasenotes/OpenSource/PerlExtensionsRelNotes/index.html)**
>
> Describes how to create universal binary extensions for Perl, Python, and Ruby.

(i know it says perl extensions, but it applies to ruby too)  
Surprise, you’ve got a cross compiler: a ppc mac can build i386  
binaries and vice-versa.

Fred

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [August 15, 2008, 11:12am UTC](https://www.ruby-forum.com/t/difficulty-with-gem-install-on-osx/145944/3 "2008-08-15T11:12:24Z")

</div>

So here’s my first attempt, using ksh:

export ARCHFLAGS=‘-arch ppc’  
sudo gem install mysql

it’s going to cook for a while so…

Yes, I know that gcc can be built as a cross compiler but I’m not  
particularly interested in dedicating time/space to building for a  
system I don’t have.

cooking’s done, more burned toast.

same -arch ppc -arch i386 failure that looks like this:

“gcc -o conftest -I. -I/System/Library/Frameworks/Ruby.framework/  
Versions/1.8/usr/lib/ruby/1.8/universal-darwin9.  
0 -I. -I/usr/local/include -arch ppc -arch i386 -Os -pipe -fno-common  
conftest.c -L”." -L"/System/Library/Frame  
works/Ruby.framework/Versions/1.8/usr/lib" -L"/usr/local/lib" -L. -  
arch ppc -arch i386 -lruby -lmysqlclient  
-lpthread -ldl -lm "  
cc1: error: unrecognized command line option “-arch”  
cc1: error: unrecognized command line option “-arch”  
cc1: error: unrecognized command line option “-arch”  
cc1: error: unrecognized command line option “-arch”

life would be much simpler if we had all continued to follow Dennis  
Ritchie et.al. off to Plan9, eh?

On Aug 14, 10:47 pm, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [August 15, 2008, 11:38am UTC](https://www.ruby-forum.com/t/difficulty-with-gem-install-on-osx/145944/4 "2008-08-15T11:38:13Z")

</div>

On 15 Aug 2008, at 10:33, Rick wrote:

> so here’s what worked…
> 
> sudo env ARCHFLAGS=’’ gem install mysql
> 
> thanks for your help

Yup, that’s important as sudo cleans up the environment before  
executing the command you’ve asked so your ARCHFLAGS settings get  
ignored

Fred

---

<div class="post-metadata">

**Author:** ![rick](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/9f8e36/32.png) [@rick](https://www.ruby-forum.com/u/rick)\
**Post date:** [August 15, 2008, 11:34am UTC](https://www.ruby-forum.com/t/difficulty-with-gem-install-on-osx/145944/5 "2008-08-15T11:34:41Z")

</div>

so here’s what worked…

sudo env ARCHFLAGS=’’ gem install mysql

thanks for your help

Rick
