CouchDB on Mac OS 10.5 via MacPorts

CouchDBFirstly, this post assumes you know what CouchDB is. If you haven’t heard of CouchDB before, hop over to couchdb.apache.org to find out more about it.

There are 2 easy ways to get CouchDB running on Mac OS (excluding compiling from source):

CouchDBX

Download and run CouchDBX from Jan Lehnard’s blog. This includes everything you need to need to run CouchDB in one neat bundle – including the erlang runtime. At the moment it is Intel Leopard only.

MacPorts

MacPorts features both the CouchDB 0.8.1 stable release and the CouchDB 0.9.0a development release. Here is how you get it running:

$ sudo port
[Users/deepak] > install couchdb

At this stage port will download and install a bunch of tools and dependencies required to build and run CouchDB. Once port finishes installing, exit to shell prompt again.

Now if things went well, you should be able to start CouchDB as:

$ sudo couchdb

Unfortunately, things didn’t quite work out for me. CouchDB logged the following output to the terminal but didn’t start:

Apache CouchDB 0.8.1-incubating (LogLevel=info)
Apache CouchDB is starting.

Config Info /opt/local/etc/couchdb/couch.ini:
	CurrentWorkingDir=/opt/local/var
	DbRootDir=/opt/local/var/lib/couchdb
	BindAddress="127.0.0.1"
	Port="5984"
	DocumentRoot=/opt/local/share/couchdb/www
	LogFile=/opt/local/var/log/couchdb/couch.log
	UtilDriverDir=/opt/local/lib/couchdb/erlang/lib/
couch-0.8.1-incubating/priv/lib
	DbUpdateNotificationProcesses=
	FullTextSearchQueryServer=
	javascript=/opt/local/bin/couchjs /opt/local/share/couchdb/server/
main.js

I finally tracked the problem down to the missing log folder which CouchDB was trying to access. So doing this:

$ cd /opt/local/var
$ sudo mkdir log
$ cd log
$ sudo mkdir couchdb

Followed by attempting to start CouchDB again, did the trick:

$ sudo couchdb
Apache CouchDB 0.8.1-incubating (LogLevel=info)
Apache CouchDB is starting.

Apache CouchDB has started. Time to relax.

You can check that all is well by issuing:

$ curl http://127.0.0.1:5984/

Which should return with the following output (or something similar to it):

{"couchdb":"Welcome","version":"0.8.1-incubating"}

You can also have control CouchDB with lauchctl (via):

sudo launchctl load /opt/local/Library/LaunchDaemons/org.apache.couchdb.plist
sudo launchctl start org.apache.couchdb

iLife’09/iWork’09 availability in India

iLife’09 should be officially available at both imagine and Reliance iStore outlets in Bangalore on coming Wednesday. It is expected to retail at around Rs. 4,320.

iWork’09 is also expected to be here on Wednesday and will cost roughly Rs. 4,320 as well.

The refreshed MacBook White is also available in Bangalore now. At around Rs. 56,580, it was always the choice for the buyers on a budget. With the recent upgrade to NVIDIA GeForce 9400M, it is absolutely the best value for money. No wonder then, it is doing quite well in the market here. I wish it still came in Black. Most cities in India tend to be on the dusty side and the White MacBook picks grime in no time.

Opening .CHM files on a Mac

CHM or Microsoft’s Compiled HTML Help format is quite widespread these days. You’ll find a lot of ebooks and documentation in this format . For example both MySQL and Apache offer their documentation is this format – the latter doesn’t offer PDFs at all. I really wish Preview handled CHM files as well, but since it doesn’t, I’ve been looking for a CHM viewer on Mac OS that has similar polish.

I recently ran into two programs that come close to Preview’s handling of PDFs – both of them free and open source.

The first one is called ArCHMock and can be downloaded from their google code page.

My current favorite however, is a product called iChm – mostly because it allows me to search the index of a CHM file as well as search for a word within the page I am on. ArCHMock seems to unite these two search paradigms (ironically, much like Preview does for PDF files!).

iChm is hosted on google code too. iChm also has a paid ($6.99) version [iTunes App Store link] for iPod touch/iPhone – handy if you want to study those manuals on your long commute!

Enable write access to an NTFS partition

Out of the box, Mac OS 10.5 comes with read access to NTFS. Here is how you can enable Mac OS to write NTFS formatted disks:

MacFUSEDownload and install MacFUSE: MacFUSE is a google project that enables 3rd parties to extend Mac OS X’s ability to handle different filesystems.

Once you are done, you can upgrade and uninstall MacFUSE from System Preference panel:

MacFUSE under System Preference

MacFUSEDownload and install NTFS-3G: NTFS-3G driver is available as a .dmg from macntfs3g.blogspot.com. I’ll recommend downloading the stable release. You’ll be prompted to restart your machine after installation.

That’s it! Now each time you connect an NTFS formatted disk to your system, you’ll be able to write files to it. The performance for me was a little slow – especially for large files (I tired copying a 30 GB VM disk to an external 5400 RPM USB 2.0 powered disk and it took close to 2 hours). But you’ll probably not notice it during your day-today usage.

As a bonus, the Disk Utility gets an ability to format disks as NTFS!

Disk Utility

Random rants from working on an old iMac

Apple iMac G5

I recently inherited an old iMac G5 at work and it has helped broaden my perspective on Macs. Here are some random observations:

This is an August 2004, 17″ model. The body is largely plastic (white plastic at that!). It doesn’t have an integrated iSight web-cam. Still I was pleased to see a matte screen. The machine has 3 USB and 2 FireWire ports (same as current iMac models).

The machine was running Mac OS 10.3.9 (Panther) which was my biggest pain point. The OS itself was quite usable but practically every new Mac product doesn’t support Panther. I knew I had to move to Tiger or Leopard.

Ultimately, I did a clean install of Leopard. The OS is reasonably snappy (and boots-up fast too) for a machine that is 4 years old and boasts of just 1.2 GB memory. I wasn’t allowed to boot from an external bootable USB hard-disk, so I installed the OS off the DVD. (Holding down the Alt/Option key after boot-up sound only showed DVD as an option). While I’ve rued the big file sizes of Universal Binaries as an intel Mac user, I’ve now developed great appreciation for Apple having kept things this way. I could reuse my already downloaded applications without having to download a special PowerPC version.

The keyboard felt very clunky and was a pain to type on! It does have two USB ports on it to which you can hook-up the mouse. I am replacing it with the new aluminum keyboard tomorrow.

I am no fan of the Mighty Mouse, but the mouse that came with the iMac G5 makes the Mighty Mouse look good! I sorely miss the presence of a scroll wheel/scroll ‘ball’.

Virtualization is virtually ruled out. Parallels, VirtualBox and VMWare are intel/x86 only. Connectix used to have a PowerPC virtualization product, but after Microsoft acquired them it seems to have vanished after a few years of being on life support.

The iPhone SDK is again intel only. Thankfully, the dev tools (XCode 3 et. al.) still install – even if you have downloaded the iPhone SDK package.

It’ll be interesting to see how much success I have installing open source packages via MacPorts. I need to install mod_perl and an assortment of CPAN modules – the ones that come with Mac OS 10.5 don’t cut it for me.