Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

Posts Tagged ‘MySQL’

Using Ruby MySQL Gem with MAMP 1.8.x on Snow Leopard

Being primarily a PHP developer, I always use an AMP package no matter what development platform I am on. So when it comes to developing Ruby/Rails applications on the same platform, I’d like to use what is already available.

Mike Boone has posted a very useful tutorial on how to get MySQL gem and MAMP 1.7.2 up and running. So, to recap and make the tutorial compatible with Snow Leopard and MAMP 1.8.x, here is what you need to do:

  1. Download the latest MAMP dmg file.
  2. Download the 1.8.2 (or whichever the latest one you could find) components file from this page.
  3. Unzip, mount the dmg, then copy the MySQL source file (mysql-5.1.37.tar.gz) to somewhere on your hard drive.
  4. Untar the MySQL source file, and `cd` to the source file directory.
  5. Compile the library:


    $ ./configure --with-unix-socket-path=/Applications/MAMP/tmp/mysql/mysql.sock --without-server --prefix=/Applications/MAMP/Library

    $ make -j2

  6. Copy the compiled libraries into MAMP:

    $ cp libmysql/.libs/*.dylib /Applications/MAMP/Library/lib/mysql

  7. Copy the MYSQL headers into MAMP:


    $ mkdir /Applications/MAMP/Library/include

    $ cp -R include /Applications/MAMP/Library/include/mysql

  8. Install the Ruby MySQL Gem, on Snow Leopard:


    $ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

    On Leopard:


    $ sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/Applications/MAMP/Library/bin/mysql_config

Enjoy!

EDIT @ 2009-11-23: If you’re still experiencing problems (perhaps with RVM), try adding “/Applications/MAMP/Library/bin/” to your $PATH in “~/.bash_profile”.

Related posts

Sequel Pro: Time to Ditch CocoaMySQL (Almost!)

For a very very long time, a lot of MySQL developers are stuck with the abandoned CocoaMySQL. Even though there are a number of other products exist, such as the GUI Tools from MySQL, Navicat and YourSQL, many developers include myself still find CocoaMySQL more user friendly (not in terms of the features but the overall ‘feel’ of the application).

Today I have stumbled across a new application: Sequel Pro. It is a fork of CocoaMySQL just like CocoaMySQL SBG, but unlike the latter, Sequel Pro is actively under development and the latest stable version ( v0.9.2 ) was released on October 21, 2008.

The first thing I noticed is the performance boost. In CocoaMySQL, browsing a table with thousands of records could be a pain thing to do, Sequel Pro has fixed this issue and the performance matches most of other tools.

Interface wise there is not much difference between the two, I suspect the GUI will be refined in the future because there are some minor issues such as missing icons.

One feature I hope they will implement soon, is the ability to reorder table fields, the last thing I want to do is to fire up YourSQL (or PhpMyAdmin) just for reordering some fields.

One annoying bug I’ve discovered shortly after using it, is that the connection window (CMD + N) has some major issues accepting correct passwords. If I create two new connections with the same username, the two usernames are forced to have the same passwords, weird behaviour.

Having said that, Sequel Pro is still a welcoming product that holds a future. The performance increase along warrants the ‘migration’ from CocoaMySQL.

Let’s wait and see how the project goes. :)

Related posts