# New User, cannot run "Hello World" on OS X

**URL:** <https://www.ruby-forum.com/t/new-user-cannot-run-hello-world-on-os-x/162100>\
**Category:** Rails\
**Created:** [March 5, 2009, 6:32pm UTC](https://www.ruby-forum.com/t/new-user-cannot-run-hello-world-on-os-x/162100 "2009-03-05T18:32:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsulmar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f4b2a3/32.png) [@jsulmar](https://www.ruby-forum.com/u/jsulmar)\
**Post date:** [March 5, 2009, 6:32pm UTC](https://www.ruby-forum.com/t/new-user-cannot-run-hello-world-on-os-x/162100/1 "2009-03-05T18:32:00Z")

</div>

I installed a ROR environment on my OS X machine, and I cant’ past  
“go” with my “hello world” application. Can anyone help me figure  
this out?

Problem Summary  
I cannot get my “Hello World” application to work.  
[http://localhost:3000/](http://localhost:3000/) view is OK but  
[http://localhost:3000/say/hello/](http://localhost:3000/say/hello/) fails

Environment  
Mac OS X v10.5.6  
ruby 1.8.7 (2008-08-11 patchlevel 72)  
gem 1.3.1  
rails 2.2.2  
mysql  
mysql Ver 14.14 Distrib 5.1.32, for apple-darwin9.5.0 (i386) using  
readline 5.1  
(followed install procedure at

> **[Dan Benjamin](https://danbenjamin.com)**
>
> Dan Benjamin's personal website.

)  
I created a “say” controller with an empty “hello” method. I also  
created view.rhtml

ERROR- Browser View  
[http://localhost:3000/say/hello/](http://localhost:3000/say/hello/)  
MissingSourceFile in SayController#hello  
no such file to load – mysql  
RAILS\_ROOT: /Users/Joes/Sites/joes\_app  
This error occurred while loading the following files: mysql

Mongrel Console View  
Rendered /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/  
action\_controller/templates/rescues/\_trace (136.7ms)  
Rendered /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/  
action\_controller/templates/rescues/\_request\_and\_response (1.2ms)  
Rendering /usr/local/lib/ruby/gems/1.8/gems/actionpack-2.2.2/lib/  
action\_controller/templates/rescues/layout.erb (internal\_server\_error)

WEBrick Console View  
!!! The bundled mysql.rb driver has been removed from Rails 2.2.  
Please install the mysql gem and try again: gem install mysql.  
127.0.0.1 - - [05/Mar/2009:09:36:28 EST] “GET /say/hello/ HTTP/1.1”  
500 14173

- → /say/hello/

“gem install mysql” – failure  
console log (partial)  
joe-sulmars-imac2:~ Joes$ gem install mysql  
WARNING: Installing to ~/.gem since /usr/local/lib/ruby/gems/1.8 and  
/usr/local/bin aren’t both writable.  
Building native extensions. This could take a while…  
ERROR: Error installing mysql:  
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install mysql  
checking for mysql\_query() in -lmysqlclient… no  
checking for main() in -lm… yes  
checking for mysql\_query() in -lmysqlclient… no  
checking for main() in -lz… yes  
checking for mysql\_query() in -lmysqlclient… no  
checking for main() in -lsocket… no  
checking for mysql\_query() in -lmysqlclient… no  
checking for main() in -lnsl… no  
checking for mysql\_query() in -lmysqlclient… no  
\*\*\* extconf.rb failed \*\*\*  
Could not create Makefile due to some reason, probably lack of  
necessary libraries and/or headers. Check the mkmf.log file for more  
details. You may need configuration options.

mkmf.log (partial)  
find\_library: checking for mysql\_query() in -lmysqlclient…  
-------------------- no  
"gcc -o conftest -I. -I/usr/local/lib/ruby/1.8/i686-darwin9.6.0 -I. -I/  
usr/local/include -D\_XOPEN\_SOURCE -D\_DARWIN\_C\_SOURCE -  
D\_XOPEN\_SOURCE=1 -fno-common -pipe -fno-common conftest.c -L. -L/  
usr/local/lib -L/usr/local/lib -L. -lruby-static -lmysqlclient -  
lpthread -ldl -lobjc "  
conftest.c: In function ‘t’:  
conftest.c:3: error: ‘mysql\_query’ undeclared (first use in this  
function)  
conftest.c:3: error: (Each undeclared identifier is reported only once  
conftest.c:3: error: for each function it appears in.)  
checked program was:  
/\* begin _/  
1: /top/  
2: int main() { return 0; }  
3: int t() { void ((volatile p)()); p = (void (()()))mysql\_query;  
return 0; }  
/_ end \*/

---

<div class="post-metadata">

**Author:** ![jsulmar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f4b2a3/32.png) [@jsulmar](https://www.ruby-forum.com/u/jsulmar)\
**Post date:** [March 5, 2009, 6:43pm UTC](https://www.ruby-forum.com/t/new-user-cannot-run-hello-world-on-os-x/162100/2 "2009-03-05T18:43:45Z")

</div>

Looks like you’ve got the i386 version of mysql… that makes things  
easier…

Try…

gem install -V mysql – --with-mysql-config=/usr/local/mysql/bin/  
mysql\_config

-philip

---

<div class="post-metadata">

**Author:** ![jsulmar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f4b2a3/32.png) [@jsulmar](https://www.ruby-forum.com/u/jsulmar)\
**Post date:** [March 5, 2009, 8:27pm UTC](https://www.ruby-forum.com/t/new-user-cannot-run-hello-world-on-os-x/162100/3 "2009-03-05T20:27:31Z")

</div>

Philip H. wrote:

> Looks like you’ve got the i386 version of mysql… that makes things  
> easier…
> 
> Try…
> 
> gem install -V mysql – --with-mysql-config=/usr/local/mysql/bin/  
> mysql\_config
> 
> -philip

Depending on your installation it might take some additional tweaking as  
well. I you end up getting an error related a .dylib file then search  
this forum for a recent post that has the answer.

---

<div class="post-metadata">

**Author:** ![jsulmar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f4b2a3/32.png) [@jsulmar](https://www.ruby-forum.com/u/jsulmar)\
**Post date:** [March 6, 2009, 2:25am UTC](https://www.ruby-forum.com/t/new-user-cannot-run-hello-world-on-os-x/162100/4 "2009-03-06T02:25:29Z")

</div>

Thanks for the responses.

After reading and experimenting a lot today, I have solved, or at  
least worked around, the problems for my installation.

It seems:

1. rails 2.2.2 requires a connection to a working database even if the  
application does not use a database (e.g. “Hello World”). Otherwise,  
you get the “SayController#hello” message

2. the default database used by rails 2.2.2 is sqlite3, so if you want  
to use mysql you need to create the project with “rails my\_app -d  
mysql” ( or you can edit database.yml)

3. the mysql gem installer must be told where MySQL has been  
installed.  
“sudo gem install mysql – --with-mysql-dir=/usr/local/mysql”

4. after successfully installing the mysql gem, my “Hello World”  
application still produced a browser message "dlsym(0x1ee0dc0,  
Init\_mysql): symbol not found ". The mysql gem does not seem to work  
with 64-bit MySQL. By installing the 32 bit MySQL package I was able  
to resolve this final issue.

Whew! I’m lucky it only took 2 days. Now I can start creating some  
real bugs.

---

<div class="post-metadata">

**Author:** ![jsulmar](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/f4b2a3/32.png) [@jsulmar](https://www.ruby-forum.com/u/jsulmar)\
**Post date:** [March 6, 2009, 7:51am UTC](https://www.ruby-forum.com/t/new-user-cannot-run-hello-world-on-os-x/162100/5 "2009-03-06T07:51:57Z")

</div>

Just as an aside, if you are just experimenting with small things,  
SQLite works really REALLY well. I recommend maybe giving it a  
shot … as long as you don’t go all crazy outside of Rails’ handling  
of SQL, then the portability of your code from SQLite to almost any  
other DB adapter (my experience has been with PostgreSQL) is  
relatively easy.
