Welcome to Geek Times!
spacer
Mac OS X: CVS install
Find on this site:


home
search
archive
about

.
The Concurrent Versions System (CVS) tool saves the day
29 May 2001

Darwin As I move forward, using Mac OS X as my primary development platform, I realize that I have to install the CVS (Concurrent Versions System) version control tool so that I can protect my source code from, err, myself. CVS allows me to snapshot the state of a working system and recover the source code should I zig when I should have zagged. This is called "bread-crumbing", an allusion to childrens stories in which characters leave a trail of bread crumbs while exploring so they could turn around and follow the trail back out. It works better with CVS :-)

This page describes installing, configuring, and getting started using the CVS version contorl tool which comes with Mac OS X. Rather than describing what you're doing, I'll show you exactly what to do. You'll do the work of acquiring and installing software from within the Terminal application, using a web browser only for the testing steps.

I assure you that the UNIX commands I'll direct you to invoke have been taken directly from a Terminal window - these are the commands I just used to do a clean install - rather than having been composed after the fact. This is *exactly* what worked for me. I've taken pains to choose forms of the commands which should make sense to you even if you're new to UNIX.

What is CVS?

CVS is a set of development tools which allow you to save snapshots of the files in a software project. This is useful if you do something foolish and wish to backtrack to the latest working version. You may have heard of this type of behavior called "bread-crumbing", an allusion to childrens stories in which characters leave a trail of bread crumbs while exploring so they could turn around and follow the trail back out. It works better with CVS :-)

A brief aside about the environment variables

CVSROOT_DIRECTORY is the location where CVS maintains its workspace, known as the "CVS root directory". Many folks keep it in /CVS or in /CVSROOT, but I prefer to keep it in my own Documents directory so that it'll be backed up frequently. (I back up my Documents daily but my entire UNIX system only infrequently.) It doesn't matter where you place it.

CVSROOT is the environment variable which the CVS programs use to figure out how to operate.

Prepare your environment

Using your favorite text editor (pico, vi, or emacs on the command-line side or SimpleText or BBEdit on the graphic user interface side) edit (or create and edit) a file named .tcshrc in your home directory. Edit this file and incorporate the following:

# CVS (Concurrent Versions System) tool
# IMPORTANT: path to CVS *must* be full-qualified; can't use ~ shortcut.
setenv CVSROOT_DIRECTORY /Users/mickey/Documents/CVS
setenv CVSROOT :pserver:mickey@localhost:${CVSROOT_DIRECTORY}

Save the file, return to the Terminal, and set your environment with the settings we just created.

% chmod 775 ~/.tcshrc
% source ~/.tcshrc

Prepare the CVS root directory workspace

Two steps are required to give CVS a workspace. First call cvs with the init parameter. Then create a blank passwd file (which will force CVS to use the username/password pairs you've given your Mac OS X users).

% sudo cvs -d ${CVSROOT_DIRECTORY} init
% sudo touch ${CVSROOT_DIRECTORY}/passwd

Turn on the CVS service with NetInfo Manager

NetInfo Manager is the Mac OS X system administration tool. It may be found in Applications / Utilities. Select the Domain / Security / Authenticate menu choice, as shown:

authenticate

This will bring up the authentication dialog box. Enter the username and password of a user with administrative powers. The default Mac OS X user you created upon installation has these powers.

password

Use the scrolling lists to select the services / finger resource. Then click on the button with the icon of two folders, second from the left.

the finger resource

You will be asked whether you really want to duplicate this resource. Choose Duplicate.

confirm changes

In the bottom pane you'll be able to edit the resources. Set the port to 2401 and the name to "cvs".

result

Then quit NetInfo Manger and reboot your Mac OS X system. When your system comes back up continue reading from this point.

Log in and begin using CVS

% cvs login
(Logging in to mickey@localhost)
CVS password:
% cd some/project/you/want/to/import/to/cvs
% cvs import test YourCompany START
[elided]
No conflicts created by this import
%

You'll have to check out the source you just imported in order to perform CVS functions on it. So I moved the code out of the way and checked it out. When I reassured myself - by using diff - that the two directories were the same except for the CVS data I deleted the original.

% cd ..
% mv test test-before-cvs
% cvs checkout test
[elided]
% diff test test-before-cvs
Only in lims: CVS
% rm -rf test-before-cvs
%

I hope these installation instructions help. You'll need to refer to a CVS user's guide for the commands and their usage, but they're widely scattered across the 'net.

Clean up after yourself

You don't really need a definition for ${CVSROOT_DIRECTORY}; I created it so these directions would be a bit easier to understand. Usually people have the following single line in their .tcshrc:

# CVS (Concurrent Versions System) tool
# IMPORTANT: path to CVS *must* be full-qualified; can't use ~ shortcut.
setenv CVSROOT :pserver:mickey@localhost:/Users/mickey/Documents/CVS

You might want to - okay, you really ought to - jump up one level, to see how this fits into the big picture of developing and deploying web-based applications (and to see what other tools I've installed to work with this one).

This page is copyrighted 1993-2006 by Michael 'Mickey' Sattler, some rights reserved via the Creative Commons License. Questions and comments? Send email to the Geek Times Webmaster. (Domain and web content hosting at 1and1.)
email