zz Upgrading to Snow Leopard Part 3: MacPorts
http://www.libertypages.com/clarktech/?p=743
Upgrading to Snow Leopard Part 3: MacPorts
Posted by clark in System on August 30th, 2009
OK, here’s the “fun” part of the upgrade. Fixing MacPorts. Fortunately MacPorts installs stuff in mainly two places. /opt and /Applications/MacPorts. So that makes dismantling the old stuff relatively easy. Usually I start by moving the /Applications/MacPorts directory to the desktop and then simply renaming /opt to /opt.old so as to keep everything around. (Also note that I did a total disk backup prior to installing Snow Leopard in case of real catastrophic mistakes)
To get rid of everything (and some of these directories are legacy) do the following:
sudo rm -rf \
/opt/local \
/etc/manpaths.d/macports \
/etc/paths.d/macports \
/Applications/DarwinPorts \
/Applications/MacPorts \
/Library/LaunchDaemons/org.macports.* \
/Library/Receipts/DarwinPorts*.pkg \
/Library/Receipts/MacPorts*.pkg \
/Library/StartupItems/DarwinPortsStartup \
/Library/Tcl/darwinports1.0 \
/Library/Tcl/macports1.0
Download the Snow Leopard version of MacPorts from their installation page. Run the installer off the dmg.
Sync MacPorts via
sudo port -v selfupdate
Fix your .bash_profile and make sure that your path includes the MacPorts stuff. (You can decide if you want the Apple stuff or the MacPorts stuff in /opt privileged by setting in first in the PATH) My own PATH is set as the following:
export PATH=/opt/local/bin:/opt/local/sbin:$HOME/bin:$PATH:/usr/local/bin:/Library/MySQL/bin
Set the MANPATH in the same place. Mine is:
export MANPATH=`/usr/bin/manpath`
export MANPATH=/opt/local/share/man:$MANPATH
Note that first export actually runs a script to get the path. The kind of quotes are important.
Finally install your software. I find this updating of MacPorts a great time to decide what I really use. Often I installed stuff thinking I’d use it only to realize I’ve only run it a half dozen times. (Yeah, a lot of X11 apps including the entire Gnome install!) On a laptop that savings adds up.
I’ll offer a bit of an explanation for each package I install. I’m not saying you ought install all of these. Nor that there aren’t other good ones to install. Just that these are the ones I find useful. Let me know if I screwed up anywhere.
sudo port install mysql5
sudo port install ManOpen
sudo port install Lingon
sudo port install Pallet
sudo port install nmap
sudo port install wget
sudo port install mercurial
sudo port install git-core
sudo port install subversion
sudo port install rsync
sudo port install bison
sudo port install flex
mysql5: The latest mysql. Really, you do need this although a lot of my friends swear by postgres. (Edit: I’d suggest building MySQL from source. I have a followup post on how to do it)
py-mysql: Since py-mysql isn’t working right with easy_install (see Friday’s post) I installed it via MacPorts. Normally I don’t like to install anything Python via MacPorts due to questions of what module is in what install of Python. I’ll let you know here of any problems I encounter. (Edit: Not working right with 2.6 – the version I installed was for an earlier version I discovered)
ManOpen: This is my favorite man entry reader. (Oddly, it didn’t compile right the first time I installed it) I also place in my .bash_profile an alias from man to ManOpen.
alias man=openman
Lingon: A must have and a bit easier to keep up to date via MacPorts rather than downloading directly. (Make sure you don’t accidentally have two copies, as I did for a while, as it can get confusing) I use this a lot to run scripts at certain times or under certain events (like disk insertions).
Pallet: A gui for installing or removing ports. I honestly still use the terminal most of the time but this is nice to have.
nmap: A great port scanning tool. I honestly use this a lot on my local network to find the ip address to ssh into. It’s very nice for rarely accessed machines or machines using dhcp. This is the command I use the most:
nmap -p 22 192.168.1.1-255
wget: Pretty similar to curl but a little simpler for downloading. I find I use it most of the time over curl.
mercurial: My versioning control system of choice at the moment. I confess I’m still learning it.
git-core: For those repositories I need to access. I still like things about git even though I’ve decided on mercurial.
subversion: ditto.
rsync: I like to have the latest version without mucking around with the Apple version.
bison: I have some specialized scripting languages for indexing and data analysis that I wrote and maintain using flex and bison.
flex: ditto.
There are a few others I install. But that’s all I’m installing today. I saved about 10 gig, I noticed, updating MacPorts. Not bad. I have about a half dozen ports I might install. Once MacFuse is uptodate in MacPorts (it’s 1.7 right now, but 2.0 is what runs under SL) I might add that to the mix.
Comments
Post a Comment