Error when trying to install MySQL on a Mac with Ruby on Rails

When trying to install mysql I got the following error:

Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb --with-mysql-dir=/usr/bin --with-mysql-lib=/usr/lib64/mysql
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out

After some googling, I found the following tutorial which I think should help me fix this:

.. only problem with the above blog post is that instead of it being
location mysql_config 
it should be
locate mysql_config

Edit 1: Still didn't work. Installing XCode to see if that fixes it.

Edit 2: After installing XCode it finally installed!!

Edit 3: Looks like it actually didn't work. New error when I used the command: rake db:migrate

rake aborted!
uninitialized constant MysqlCompat::MysqlRes
After googling, I found a StackOverflow post which said to use the command
sudo env ARCHFLAGS="-arch x86_64" gem install mysql
Then I tried the "rake db:migrate" command and it worked!!! I'll update again if something breaks.

How to change the path variable in Mac OS X

This is a bit trickier than it was in Windows, but not too bad once you get the hang of it.

1. Open up the terminal

2. Type the following: 

export PATH=$PATH:/usr/local/mysql/bin>> ~/.bash_profile

Note: You would replace "/usr/local/mysql/bin" with whatever path you want to add to your system. 

What this does is take your current path, represented by the variable "$PATH", and concatenates the string that follows it, ending with the ">>". It then adds that new string to the path, represented by PATH=, and it knows what file to edit by looking at the last part "~/.bash_profile" The first 2 characters "~/" simply tell the machine to search anywhere in the hard drive for the file ".bash_profile" and finally, the "." before "bash_profile" tells us that this file is hidden.

3. Type enter
Screen_shot_2010-10-15_at_12
4. Type the following:

env

5. Type enter

6. Look for the line that starts with PATH= and you should see your path added to the others.

7. Do a happy dance! You're done.

Happy_dance

Helpful Videos and Tools When Taking CS 124 at BYU

As I go through the semester, I'll add videos and other resources to this list that I found useful. Hope you find this helpful!

 

 

Prof. Anant Agarwal from MIT explains concepts similar to CS 124. This guy is really good at explaining things on an intuitive level and also every lecture he has a different surprise about half-way through to help drive home the concepts he's teaching. Highly recommended lecturer if you're feeling lost about NAND gates, AND gates, and digital abstraction.

MIT Basics of digital abstraction (starts getting into the stuff we cover in this course at about 42:20)

MIT Inside the Digital Gate

 

Multiplexer

 

Simple Binary Math

Sign & Integer, One's Complement, and Two's Complement

 

AND, OR, NOT, NOR, NAND, XOR, ADD

http://teahlab.com/ I used this site as a reference to remember what the difference between NOT, OR, AND etc. are.

 

Online Digital-Circuit Sandbox

http://logic.ly/

Just made the switch to Posterous

They made it so easy to import from Wordpress I couldn't resist! They even copy your old URL structure so your links don't break.
Tags