Drupal 6.15 on Snow Leopard

Recently I got my hands on a MacBook Pro with OS-X 10.6 on it. One of the reasons I’m not too hot on the Mac is that getting non-Apple development tools and software to work on the Mac can be a serious PITA experience. I suppose I could wax elegant about other things I don’t like about a Mac, but it is a nice piece of hardware so it would be cool to see if I can get Drupal installed and working and then be able to really develop on the platform.

To start off here’s an inventory of “crap” that needs to get done:

  1. Get a proper version of Apache installed
  2. Get PHP installed and configured
  3. Get MySQL installed and configured
  4. Get MySQL admin tools installed
  5. Get Drupal installed

Now of course trying this all from scratch would be insane, right? Absolutely. I found a number of helpful sites, but no single site had all the tricks necessary (at least on my machine) to get it all installed and working right. Here’s a list of the major web resources that I used:

The first link is definitely where to start. This is a very good post – but I found a few things a bit difficult. First off – how does one open a command line window, aka shell? Uh – of course that is in applications/utilities in the Finder.  Next up – my vi and emacs is very rusty. I’m spoiled on Windows and Linux with notepad and gedit. I found another much simpler text editor called Pico that you can start from the Mac terminal.

I ran thru the instructions in the first url above and got PHP and MySQL installed. I did not install the XDebug stuff – I tried but the setup didn’t work so I gave up. I should point out that I already had XCode setup on my machine for iPhone development stuff that I do. I was able to login to MySQL and create a database and accounts for my drupal user. Then I remembered that there are some GUI tools for Windows from MySQL adn sure enough there are GUI tools for Mac here. They look and feel pretty much like the Windows versions. I had some initial problems getting the tools to actually connect to the database. MySQL clients connect to a database running on a local machine thru a socket file. For whatever reason my socket file was either in a funny place or something. I was getting a message about not being able to find the socket file. If you get that error there’s an option button on the login screen. Click that arrow and there’s a text box where you can manually set the location of your socket file. My file is at this location:

/opt/local/var/run/mysql5/mysqld.sock

Once I corrected that issue I could log into the admin tools with no issues. It will save that value so this is a one time only thing.

Now it is time to try out the Drupal installation, but um – where is my apache web root? When we ran Drewish’s instructions we installed a second copy of apache so it is not the one in /opt/local/apache2. After much probing, brain squeezing, and sweating I figured it out – of course it is in /Library/WebServer/Documents 🙂

A quick drag and drop of the drupal files into there and puch up the install url (http://localhost/drupal/install.php) and the installation is good to go…almost. Depending on how you have MySQL installed you might get some errors about not connecting to the database with “youraccount@localhost” during the connection test. My solution was to go into the MySQL Admin tool, select the user, and make sure the db account localhost has privs to your drupal database.

With that out of the way – the installer completes with no issues and my Drupal site is ready to go.

So wow – that was a pretty exhausting experience compared to windows, but it is better than it used to be. Next up I will have to try out getting Eclipse, Aptana, or some other familiar tool running on the mac so that I can actually develop something – perhaps a Saab RIP theme dedicated to my now defunct brand.

I learned some handy commands during all this for working on my Mac:

  • Mac ports is pretty cool – it is kind of like yum on linux
  • Working with text files on the command line is a pain – use pico if you don’t feel like trying to remember all those vi commands
  • Apache conf file is in /private/etc/apache2
  • Apache’s web root is in /Library/WebServer/Dcouments

If I remember any more I’ll update the list.

6 Comments

  1. cbdebris

    There’s a free tool at apple.com/downloads that does the Drupal install and setup for you.

    Reply
  2. Beren (Post author)

    True – but then you have to live with how Apple wants you to work and which version of the software that you should use. Plus you are ignorant of ewxactly what they have done and where it meant so when it comes time for troubleshooting an issue it becomes more difficult to figure it out and worse to fix it.

    I have similar concerns the XAMP and other “package installs” like it.

    Thanks for the comment – as most people will probably want to stick to the easy road with something like the Apple downloads approach.

    Reply
  3. Pingback: JBoss 5 and Alfresco 3.3 on Mac OS-X « Tarn Aeluin

  4. Ben Lavery

    Nice piece and has helped me install Druple on my Mac, though a little less Mac bashing at the beginning would have been nice. For the record I’ve never had a problem installing other dev tools on my Mac, be they GNU utilities or great IDE such as Netbeans or Eclipse. Also, I expect you have a MacBook Pro, PowerBooks won’t run 10.6 as they are PPC and 10.6 only has x86 (32 and 64-bit) support.

    Reply
  5. Beren (Post author)

    Thanks glad it was helpful – and yeah its a MacBook Pro…I’ll have to update that.

    Reply
  6. Pingback: 2010 at the Lake « Tarn Aeluin

Leave a Reply