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:
- Get a proper version of Apache installed
- Get PHP installed and configured
- Get MySQL installed and configured
- Get MySQL admin tools installed
- 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:
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.