Dead Ink Vinyl

Musings of David L Kinney

Posts Tagged ‘osx

CouchDB on MacOSX Leopard

with 5 comments

I got CouchDB up and running as a service on my MBP OSX Leopard this past Monday. It wasn’t as straight-forward as I’d hoped, so I thought I’d share my process for the benefit of others.

Installing CouchDB

I installed CouchDB from source. This requires the Leopard development tools (Xcode) and MacPorts. I expect all developers to have Xcode installed and most developers to have MacPorts installed, so I won’t detail those steps here.

First, install CouchDB’s dependencies using MacPorts:

sudo port install icu erlang spidermonkey

Download CouchDB and extract it. This is standard configure, make, make install territory here:

./configure
make && sudo make install

Wasn’t that easy?

Creating a couchdb System Account

Find a user number that is available. To see a list of what numbers are already in use, run:

dscl . -list /Users UniqueID | awk '{print $2}' | sort -n

Now find a group number that is available. To see a list of what numbers are already in use, run:

dscl . -list /Groups PrimaryGroupID | awk '{print $2}' | sort -n

On my system, number 103 was available for both a user number and a group number. The rest of this article assumes you are using 103 as well.

The following commands create the group and the user and set the user’s home directory to the CouchDB lib folder.

sudo dseditgroup -o create -i 103 -r "CouchDB Users" couchdb
sudu dscl . -create /Users/couchdb
sudu dscl . -create /Users/couchdb UniqueID 103
sudu dscl . -create /Users/couchdb UserShell /bin/bash
sudu dscl . -create /Users/couchdb RealName "CouchDB Administrator"
sudu dscl . -create /Users/couchdb NFSHomeDirectory \
        /usr/local/var/lib/couchdb
sudu dscl . -create /Users/couchdb PrimaryGroupID 103
sudu dscl . -create /Users/couchdb Password *

Finally, we give the couchdb user ownership of the CouchDB lib and log directories:

sudo chown -R couchdb:couchdb /usr/local/var/<strong>lib</strong>/couchdb
sudo chown -R couchdb:couchdb /usr/local/var/<strong>log</strong>/couchdb

DONE! Now you can launch CouchDB as the couchdb user instead of root.

sudo -u couchdb couchdb

Running as a Service

To control CouchDB using launchctl, I needed to add the appropriate PATH information to CouchDB’s Launch Daemon plist so that gawk is found. Unfortunately, I couldn’t find a solution to edit the plist in-place as a privileged user, so I copied the file to the /var/tmp directory without root privileges so that I could update the copy.

Creating a copy of the plist and opening it for editing is done by:

cp /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist \
        /var/tmp/org.apache.couchdb.plist
open /var/tmp/org.apache.couchdb.plist

In the Property List Editor that opens, follow this steps:

  1. Open Root → EnvironmentVariables
  2. Click on Add Child
  3. Name: PATH
  4. Value: /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:/opt/local/bin:/opt/local/sbin
  5. File → Save
  6. Quit Property List Editor

Then copy the updated plist over the original plist:

sudo cp /var/tmp/org.apache.couchdb.plist \
        /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist 

Now CouchDB can be controlled and monitored by the standard Leopard daemon manager:

sudo launchctl load \
        /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist 

Launch CouchDB on Startup

To automatically launch on start up, run

sudo ln -s /usr/local/Library/LaunchDaemons/org.apache.couchdb.plist \
        /Library/LaunchDaemons/org.apache.couchdb.plist

Congratulations! You have CouchDB running as a system service that will start when you boot your Mac. Let the fun commence.

I’d Like to Thank the Academy…

I’d like to thank the following sites and resources for providing me enough information to piece together the process:

I particularly recommend the evang.eli.st article, as it explains the dscl command, which may be an unfamiliar account management tool.

I should point out that evang.eli.st also has a complete write-up on how to install CouchDB on OSX. That walk-through is almost a year old, though, and entails editing the Makefile—which doesn’t sit well with me. However, where Leopard departs from standard UNIX behavior, I cease being an aficionado, so his tweaks may be important in ways I haven’t yet discovered.

Written by dlkinney

July 12, 2008 at 9:39 pm

WWDC Prediction Outcomes

without comments

WWDC isn’t over yet, but we learned a lot today. Let’s see how I did with my predictions.

Category My Prediction Correct?
iPhone
3G Yes Correct
GPS Yes Correct
Faster Processor No Correct
Video Conferencing No Correct
Thicker (face-to-back) Yes Correct1
iPhone mini Yes Incorrect
Higher Pricing Yes Incorrect
SquirrelFish Yes ?
iPhone widgets No Correct2
Apple Software
OSX 10.6 Will Be Announced Yes Correct
OSX 10.6 Named Snow Leopard Yes Correct
OSX 10.6 Specifically be for Atom Devices No Correct
OSX 10.6 OSX 10.6 Will Drop PPC Support Yes ?
OSX 10.6 Will Drop Carbon Support Yes ?
New / Improved / Revamped .Mac Services Yes Correct
.Mac Rebranding Yes Correct
Apple Hardware
New Apple Device No Correct
New MBP Designs Yes Incorrect
New Displays No Correct
Pie In the Sky Prediction
OSX 10.6 Adds Resolution Independence Yes ?

Outcome: 13 correct, 3 incorrect, and 4 unknowns. So my prediction accuracy is 65%-85%, depending on how the unknowns turn out. Not bad, given that 10% of my predictions were complete guesses.

1 The original iPhone was 11.6mm thick, according to Apple’s support site and the new iPhone is 12.3mm according to the new iPhone site.

2 No discussion of a DashCode for iPhone or HTML+JavaScript+CSS application development solution was stated during the keynote. If it comes to my attention that widget iPhone development is possible, I will toggle my answer’s correctness.

Written by dlkinney

June 9, 2008 at 7:33 pm

WWDC Predictions

without comments

Welcome to my first publicized predictions for an Apple conference.

Preamble

To understand my predictions for WWDC 2008, you need to understand where I think Apple is going in the next 24 months. To view the iPhone as a stand-alone product is to miss the point. The point of the iPhone is to create a development ecosystem around Objective-C and Cocoa. This ecosystem will have spill-over benefits for the Mac, since more developers will be familiar with the platform’s development technologies, but the real point is to create a large population of developers already familiar with application development for Apple’s next device: a touch tablet. This is why Apple is suddenly pushing “OSX” instead of “Mac OSX” and “iPhone OS”—Apple wants to impress upon developers that the skills for developing on any OSX device carry over to the other Apple devices as well.

With that out of the way, on to my predictions!

Next-Generation iPhone

3G: Yes

This seems like a given.

GPS: Yes

With all of the concentration on 3G capabilities, discussion about GPS seems to have died down a bit. While GPS technology takes away space and power from other solutions apple could provide in the iPhone’s form factor (such as video conferencing), I think that improved positional capabilities will create many 3rd party developer opportunities.

Faster Processor: No

I think there are so many other bells and whistles going into this revision that Apple will be happy to use a processor with the same speed and power consumption as the current model.

Video Conferencing: No

With 3G network speeds, this becomes possible and it is an intriguing possibility. But supporting (1) video capture, (2) video encoding before sending, (3) bi-directional communication over 3G (or WiFi), (4) video decoding what you’re friend is sending you, and (5) continual screen updates to display the video—all at the same time—will simply kill the battery life.

Thicker (face-to-back): Yes

Since the current iPhone is a 1.0 product, I’m willing to believe that Apple learned a lot during its development and—knowing what they know now—could redesign the current iPhone to be smaller with lower power consumption. Starting from that assumption and adding 3G, GPS, and a larger battery to the mix, I believe that the new iPhone will have to be more voluminous. It can’t get much wider without becoming uncomfortable to hold, and it’s current height seems about right, so I believe that the phone will grow a little thicker.

iPhone mini: Yes

Take the current 8GB iPhone, make it a little smaller, and offer it in a variety of colors for $350. Offer a 4GB model for $250. Pesto! You have a device that may attract the interest of my wife. Since I didn’t understand the point of the iPod mini until I witnessed my wife’s reaction, I’ve come to trust her judgement over mine for products Apple targets at non-technophiles.

Higher pricing: Yes

Components: there are more of them and they are more expensive. With the addition of the iPhone mini at a lower price point, Apple will have a little breathing room on the high end. I expect the 8GB model to retain its current pricing and the addition of a 16GB model for $100 more.

SquirrelFish: Yes

Squirrelfish helps the iPhone in two ways. First, Squirrelfish is fast, provides users with an improved Web browsing experience. Second, it is more efficient—getting the same end result accomplished in fewer clock cycles, so it requires less power to run JavaScript.

iPhone widgets: No

In the latest episode of The Talk Show, Dan and John kick around the idea that iPhone widget applications may make a comeback: applications for the iPhone written entirely in HTML+JavaScript+CSS, facilitated by a DashCode development tool specific to the iPhone. There is a lot of sense to this from the perspective that it would invite everyone skilled in Web design to be an iPhone developer. However, as I stated in my preamble, I believe Apple can use the popularity of the iPhone as a means to push Objective-C and Cocoa, thus building a larger community of developers skilled in the technologies that underlie all of Apple’s “software-expandable” offerings.

Apple Software

OSX 10.6 Will Be Announced: Yes

Steve is quoted (somewhere—sorry, no link) as stating that he wanted to be releasing updates to Leopard on a more frequent schedule than was indicated by the delay between 10.4 and 10.5. Announcing 10.6 at WWDC with it’s release due at MacWorld seems about right to me.

10.6 Named Snow Leopard: Yes

Sure, why not?

10.6 Will Specifically be for Atom Devices: No

This was posited by Josh Bancroft and I think he’s generally right that OSX is being pushed as its own brand to allow for OSX on a new device, but I don’t think it will be announced at WWDC.

OSX 10.6 Will Drop PPC Support: Yes

This completely sucks for PowerMac G5 owners. You’re the losers of an unexpectedly rapid and successful migration to Intel. As a life-long loser myself, I sympathize.

OSX 10.6 Will Drop Carbon Support: Yes

Apple wanted to drop Carbon support long ago, but the old-time Apple developers complained and—probably more importantly—Microsoft and Adobe were unable (and perhaps unwilling) to migrate off their Carbon code bases. Reading the tea leaves, Carbon’s now a goner. Apple used the Intel migration as leverage to push developers toward Cocoa, then Leopard didn’t include support for 64-bit Carbon. If the rumors that 10.6 will be 100% 64-bit are true, that rules out Carbon. Good bye.

New / Improved / Revamped .Mac Services: Yes

Please! I’ve had .Mac service since I purchased my first Mac and it was fine for a while—I didn’t mind the premium price at first because it “just worked” and that’s what I wanted. But each of the last three years I’ve been really close to canceling my membership and Apple would announce something that would make .Mac just barely worthwhile enough to continue holding onto. This year, though, if I’m not blown away, I’m canceling it. Or whatever they will call it.

.Mac Rebranding: Yes

It’s hard to sell something called ”.Mac” to a person whose only Apple product is an iPhone. Explaining that .Mac doesn’t require a Mac must be a nightmare.

Apple Hardware

New Apple Device: No

I believe that 2009 will be the year of the tablet, so no new devices this year.

New MBP Designs: Yes

I’m just guessing here.

New Displays: No

I think that the displays will be revamped when the Mac Pro is redesigned.

Pie-In-The-Sky Prediction

Every good WWDC prognosticator needs to go out on a limb and make an off-the-wall or out-of-left-field prediction.

OSX 10.6 Adds Resolution Independence

Despite the rumors that 10.6 will be focused on stability and performance instead of features, I think that this will be on the short list of enhancements.

Written by dlkinney

June 8, 2008 at 12:31 am