November 02, 2009

Setting up Snow Leopard for the Web Developer

Article about ▸

written by Marek Foss

Developer Space

I recently wrote about setting up a mac for the web developer. However, that was still in the times of Leopard 10.5. With the upgrade to Snow Leopard 10.6 some things have changed, and I wanted to described the problems I had.

The upgrade to Snow Leopard went really smoothly and without problems. Nothing was lost, the system was fine and I could get back to work immediately. The problems started when I tried to do some web development on localhost. I kept getting Internal Server Errors from all of my scripts, and it turned out that MySQL was not working. Moreover, its process could not be started at all.

It turned out that the upgrade removed the mysql symlink from /usr/local. It is important, because normally MySQL installs itself to a directory like mysql-5.1.40-osx10.5-x86_64 – the symlink ensures all apps can use /usr/local/mysql when referring to the database, despite the version and build you deploy. So, to fix this, open the Terminal and execute these commands:

cd /usr/local
sudo ln -s mysql-5.1.40-osx10.5-x86_64 mysql

The long mysql-5.1… folder name should correspond to the folder where your MySQL is installed. After this change I was able to start up the database process. PHP was working fine, but I was unable to establish DB sockets in Perl. It turns out, Snow Leopard upgraded Perl, removing all custom modules on the way! So, there was no DBD::mysql any more…

As usual, CPAN failed to install the module. I downloaded the module’s source, and executed the manual installation routine:

perl Makefile.pl
make
sudo make install

You run these commands in the Terminal, first navigating into the folder where the source is located. After several tries, I still couldn’t get the Perl module to install itself. I googled more and found a possible cause: since Snow Leopard, most of its guts are 64-bit, and it seems that includes Perl as well. Unfortunately, my MySQL was still the one I installed with regular Leopard. And yes, it was 32-bit. So I downloaded the 64-bit package from MySQL website, installed it (remember to export your existing tables if needed!), then the Perl module successfully installed too and I was ready to develop again. And boy I’ve got loads of work :)

I’ve updated the old Setting up Mac for the Web Developer article – everything should still be valid there, except that you need to choose the 64-bit MySQL if you develop using the Snow Leopard. But let me know if you run into any problems.


If you liked the article, please spread the word and share it!

  • Share

Comments



Leave a comment: (comments may not appear immediately due to page caching)

Name: Email: (not disclosed)

WWW: Remember my details

Notify me of follow-up comments

Feed me:

(subscribe)
 to feed
  • Subscribe and get the new articles every now and then directly in your reader — I recommend using Google Reader

Connect:

 by Google
Google FriendConnect appears to be down at the moment. Sorry for inconvenience.
Related Posts with Thumbnails