Perforce SCM on OS XFeb 19, 2004 · peterb · 5 minute read
At the behest of one of the commentators here, I decided to try to download and install Perforce on my OS X laptop and see how the experience compares to installing it on FreeBSD or Windows. It worked fine for me, but I can understand how one would find the experience confusing, particularly if you’re not familiar with the unix side of the world. Here’s some notes on the experience. I have a few advantages over your novice user, in that I’ve been using Perforce for about four years, and so already understand the model it uses, and why it is better than CVS -- how the repository stores data, what the relationship between a client, a branch, and the repository is – so I deliberately tried to forget as much as I could and approach this with a fresh mind. I tried to follow the instructions as written, rather than filling in the blanks with things I’ve learned over the years.
Finding the packages themselves was no problem; Perforce has a page for Mac downloads, and there is client, server, and the visual client software available, along with some extra Macintosh-specific installation notes.
Installing the server was fairly easy; per the install notes I used the Darwin p4d software installation. I then became root via ‘sudo’, copied the p4d to /usr/local/bin, and did a “chmod a+x /usr/local/bin/p4d”. /usr/local/bin is already in my path, so I didn’t have to worry about that. But to make a long story short, I agree with reader David Trevas about this point – it really wouldn’t have killed Perforce to have provided a 5 line shell script to do this busywork for me.
Likewise, I installed the client and set up my P4PORT environment variable correctly, but then I already knew how to do that. The installation notes are indeed a bit scatterbrained about this. Hey, Perforce, you’re already printing a 3-line error message when my P4PORT is set wrong – instead of just saying “check $P4PORT”, why not spend the extra 25 characters or so to give an example of how to set it to something well formed? Or point to a URL that explains it?
In the release notes, I saw a disclaimer that, at first, I simply didn’t believe: “IMPORTANT: The Perforce server on Darwin is case-insensitive, unlike Perforce servers on other UNIX platforms.” Ouch. “That can’t be right, I thought.” I was all ready to be angry at Perforce for being stupid, when I decided to do a little experimenting, and learned Today’s Fun Fact: HFS+ is a case insensitive filesystem. This is so mind-numbingly stupid that I’m actually kind of mad at Apple about it, although I guess it’s a well known bug^H^H^H”feature” of HFS+. Apparently the bug is fixed in 10.3 Server, which provides an option to make the filesystem not suck so much. So my formal recommendation would have to be “Don’t run p4d on 10.2 or earlier, and if you run it on 10.3, turn on the ‘make the filesystem not suck’ bit (you can’t actually just twiddle a bit; you have to newfs the filesystem as case- sensitive HFS. That, in turn, will probably cause a bunch of your other applications to break).
This is actually going to present a problem to anyone using the p4 client -- or, in fact, any other version control system – which has files in a directory with filenames that are identical apart from case. In my quick tests, the behavior can be described as “last sync wins” – if you have two files, “test.txt” and “TEST.TXT”, and you sync, whichever is synced last overwrites the other. If you sync a deletion of TEST.TXT, test.txt gets deleted. Sloppy, Apple, really sloppy. OK, I know the filesystem is just doing what it’s specced to do – but what it is specced to do is dumb. For what it’s worth, Windows/NTFS seems to have the same behavior. I think it’s dumb there, too.
Apart from the case problems, which will afflict any SCM system on this platform, the p4 client worked as expected – I was able to connect to both the p4d I just started up on my Powerbook, and also to the Perforce server at work. I tried their visual client “p4v”, but didn’t love it overmuch – right off the bat it feels like it’s missing important functionality. One major point of a visual client is to make things easier for newcomers, it seems to me, and since p4v won’t even let you create a client workspace from the login screen, it seems kind of pointless to me. Perhaps it gets “better” once you’re used to it, but I quickly reverted to just using the command line client. In p4v’s favor, it comes in a .sit file and is a clickable OS X app, suitable for installation in your Applications folder. Hopefully future revisions will make it a bit more fully-featured
In summary: Perforce++ for having a readily available OS X client. Perforce++ for providing a powerful and reliable SCM system. And Perforce– for not making their installation procedures as easy as they should be.
For another perspective from someone actually using Perforce on the Mac for Real Work, read Chris Hanson’s journal (the 3:19 pm entry).
I use Perforce day in and day out, but in a nearly pure Unix environment. I’d be interested in feedback from those of you who run p4 clients on MacOS regularly, and I’m very interested to know if there are any of you out there using MacOS as a p4 server. Please share your experience in the comments section below, if you would.