This evening I’m beginning my foray into the world of Git in order to see what all of the fuss is about. On Mac, the first step was to install MacPorts. That’s also where I ran into my first problem. I don’t know yet whether this is a really nasty omen, but I thought it might be worth documenting the problem and the solution.
I started by downloading the MacPorts package installer; I seldom mess with source code installs without a compelling reason to do so. Once it was downloaded, I ran the installer. This is pretty basic stuff, so when the installer told me it completed successfully, I assumed that it, you know, completed successfully and I tried to install git:
$ sudo port install git-core
sudo: port: command not found
Oops. I’m a man; I hate reading instructions, but now I had to. So I visited the MacPorts installation instructions and they assured me that the installer would take care of everything for me:
This procedure will place a fully-functional and default MacPorts installation on your host system, ready for usage. If needed your shell configuration files will be adapted by the installer to include the necessary settings to run MacPorts and the programs it installs, but you may need to open a new shell for these changes to take effect.
I opened a new shell, but it still didn’t work. Evidently, all of this automation only happens if the default shell is bash. My default shell on every Unix (or derivative) box that I spend a significant amount of time logged into is tcsh. I have this set specifically since Mac, like most other Unix variants I’ve used, defaults to bash when a new user is created.
Fortunately, MacPorts documents the shell changes, but even the documentation is bash-centric. It’s an easy translation, though. I added the following lines to my .tcshrc file:
# Macports environment variables
set MANPATH = `manpath`
setenv PATH /opt/local/bin:/opt/local/sbin:$PATH
setenv MANPATH /opt/local/share/man:$MANPATH
Once I saved those changes, closed and reloaded my .tcshrc file (e.g. $ source ~/.tcshrc) the system was able to run the port executable.