Using memcached with stock OS X Apache
I wanted to use memcached but didn't want to compile all the dependencies by hand and wanted to use the stock version of Apache that ships with OS X so I cobbled together the following instructions.
- Install MacPorts
- Use MacPorts to install memcached:
sudo port install memcached - Use
peclto download the latest version ofmemcachedand uncompress it:
cd /tmp
pecl download memcached
tar xvzf memcached-*.tgz - Build the extension using MacPort's version of
libmemcached(which was installed as a dependency ofmemcached):
cd memcached-*/
phpize
./configure --with-libmemcached-dir=/opt/local/
sudo make install - Enable it by editing
php.iniand adding the following line:
extension=memcached.so - Restart Apache:
sudo apachectl graceful
References:
New Mac Mini
I just picked up a new Mac mini servers to replace the one that's been my desktop machine for over 2 years. The new server version has two 500GB hard drives (as opposed to the single 120GB drive I've been working with) but no optical drive. That seemed like a bit of an inconvenience since I just bought a MacBook Air and it doesn't have an optical drive either so I picked up a SuperDrive that I can use with either.
I ran through the initial install process only to realize that I couldn't setup the drives as a RAID mirror. I found a message board thread that describes how to setup the RAID mirror involving the system disk. The short version is boot off the install DVD and use the Disk Utility to create the mirror (which will wipe the disk) then install onto that.
The install and subsequent updates is starting to approach Windows XP levels. It took three rounds of running Software Update before it finished.
The next big step was running through and updated my guide to setting up Apache, PHP and MySQL on OS X. The only change I found was that the new Java update means you need to install an additional developer package before you can really use MacPorts.
Other bits:
- Enable verbose boot mode:
sudo nvram boot-args="-v" - Show hidden files in Finder:
defaults write com.apple.finder AppleShowAllFiles TRUE
Using Mercurial and SVN
At Sony we're looking for a distributed version control system to replace Subversion—primarily Git and Mercurial. I'm very familiar with Git but hadn't done much with Mercurial so it seemed like a good idea to use it for a couple of weeks and learn the quirks. Since I'm stuck using Subversion I decided to see if it would be feasible to use Mercurial as a "super client" working locally then pushing changes back to svn. A little Googling turned up two candidates hgsvn and
hgsubversion. hgsubversion extends the commands pushing and pulling changes, giving a more native experience, so it seemed like the best choice for learning the system.
The setup is actually pretty simple but I'm documenting it for my own future reference.
Use MacPorts to Install hgsubversion:
sudo port install py26-hgsubversionEnable the rebase and hgsubversion extensions:
printf "[extensions]\nrebase=\nhgsubversion =\n" >> ~/.hgrcCheck that the extension was enabled:
hg help extensionsIt should list something like:
enabled extensions:
hgsubversion
integration with Subversion repositoriesNow you're good to checkout from SVN (note: using the svn+ prefix in the URL lets you use passwords stored in your keychain):
hg clone svn+http://example.com/svn/repo/trunkI actually ran into an issue where the clone was exploding with a stack trace. The bug had been fixed in 1.1.2 but MacPorts hadn't yet been updated so I rolled a patch to update it.
Drupal 6 on OS X 10.6
Running Drupal on OS X 10.5 was a pretty huge pain in the ass. It's much easier in in 10.6 since it includes PHP 5.3 with GD and the PDO out of the box. And Drupal 6.14 resolves the PHP 5.3 incompatibilities.
In this guide I'll walk through the process I used for reinstalling OS X, then installing MacPorts and using it to install MySQL.
Note: I've shortened this up a bunch since it was first posted (originally it was using PHP 5.2 from MacPorts). I also want to make it clear that I am familiar with MAMP but would rather punch myself myself in the face than use it. If you'd like to, go right ahead since it's probably easier—and as evidenced by the commenters below—you're in good company. But I'm going to continue to compile my own so I know where everything ends up.
Text mode Cover Flow
My side project has been writing some code to display data from iTunes on my Heathkit H19 terminal.
Requirements
You'll need to use MacPorts to install ImageMagick and jp2a:
sudo port install jp2a imagemagickYou need to use Ruby's gem to install ncurses and appscript:
sudo gem install ncurses rb-appscriptThe Code
As of 24 May 2009, I've move this code to GitHub Repository. Now there's publicly accessible version control and people can fork and share changes.
Getting PHP + GD + PostgreSQL working on OSX 10.5 (aka recompiling everything)
Finding myself in need of a PostgreSQL server to test some patches for Drupal core, I've decided to do a follow up to my guide to getting PHP + GD + MySQL installed on OS X.
Fortunately for me John VanDyk wrote up Beginning with Drupal 6 and PostgreSQL on OS X 10.5 Leopard which covers the nitty gritty of getting PostgreSQL server installed. He doesn't address recompiling PHP so I'll pick up the story there.
Last Updated: June 1, 2009
Mac mini RAM Upgrades
I bought a Mac mini last week to use as a work computer--now that I've got some income I'm finally appreciating the idea of a "work expense". I didn't spring for the RAM upgrade since I felt pretty ripped off after doing that for the MacBook.
Apple only sells them with 2GB of RAM but I'd read that you could upgrade them to 3GB. I figured what the fuck I'll just buy the 4GB and stick it all in and see what happens. Well the good news is that--as you can see from the screen shot--it'll use all 4GB.

If you do try to do the home upgrade read through this RAM upgrade walk through but skip their advice for getting the case off and watch this video instead. It has a much better technique that resulted in zero scratches. Be really careful putting it back together though, I tried to rush that and bent some of the tabs in the back so it doesn't seat quite right now.
Building the C2 Morse code trainer on OSX
I was trying to install Ward Cunningham and Jim Wilson's Morse code trainer on OS X and it looks like their .dmg file doesn't work on the new Intel machines. Here's what I did to get it to build.
Using Growl to tail a log file
Mikey_p from the Portland Drupal Group pointed me towards a blog post he'd done on using Growl to watch for PHP errors. Always looking to put my fingerprints on something I decided to do the same but using PHP rather than Python.
The short version is install growlnotify then run the following from the terminal:
tail -n 0 -f ~/Sites/nm/logs/access_log | php -r 'while ($m = fgets(STDIN)) shell_exec("growlnotify -p 0 AlertTitle -m ". escapeshellarg($m));'Getting PHP + GD + pdo_mysql working on OSX 10.5 (aka recompiling everything)
This guide walks through the steps necessary to setup PHP on Leopard in order to run the HEAD version of Drupal. The basic steps are installing several prerequisites then recompiling Apache and PHP from source. It could totally bork your system, I'm just writing it down so the next time I need to do this I can remember what I did. I wish I could give credit to all the places I stole bits from but I didn't do a good job of keeping notes early on.
Every time Apple releases a security update it seems to end up overwriting PHP or Apache and I end up revisiting these instructions. Since it's my personal guide I'm continually modifying it to match my current needs. For example, the last big change was adding in old mysql extension and the new PDO-mysql extension. The upside for you, kind reader, is that this keeps the instructions up-to-date. The down side is that when you come back in two months and try to repeat one part of this it may not work because I've changed some of the earlier steps.
Last Updated: August 26, 2009
A big update
It's been a while since I posted anything here. I'm a fan of bulleted lists so I'll just resort to one of those.
- Went to New York City. Stayed from Christmas to the 3rd and had a nice New Year's. Etta and I had some pretty major drama leading to...
- An un-engagement and break-up. No need to worry about planning a wedding now. Still need to call all the relatives... That said we're still talking, maybe we'll end up out on a date this weekend. What happens with Shasta and the house are open questions.
- Got a MacBook. The trusty old ThinkPad died. I'd sworn I wouldn't buy a Mac until they had a trackpad that you could right click. Someone had convinced me that the new Macs had two separate buttons in their trackpad but you and to enable the right clicking. Turns out they were full of shit and I'm left ctrl+clicking but it's still the best laptop I've ever owned. If you like UNIX then MacPorts.org is your new best friend.
- Booked a ticket to DruaplCon Boston. I used some frequent flyer miles. I don't have a place to stay or conference reservation but that kind of thing works itself out. When I went to the BeOS Developers Convention in Palo Alto back in '99 I ran out of money for a hotel room and slept in a park in the rain. I'm hoping to crash on someone's hotel room floor this time.

