Remove/Reinstall of MacPorts

Posted by: Bruce Snyder on June 7, 2013

After trying to upgrade Mercurial to the latest version via MacPorts, I ran into some compilation issues with a couple dependencies that I could not resolve at all. After realizing that there were dependency resolution issues amongst different versions of dependencies for different ports, I decided to remove and reinstall MacPorts from scratch. This provided a clean slate and everything worked without a problem, though I was annoyed that I had to take this drastic action and spend the time to get MacPorts working again.

Bash Completion For Git

One thing that I ran into was another change to the bash completion and prompt for git. As I mentioned in a previous post about this topic, the location of the location for the git-prompt.sh file had changed but this time I discovered that I had to source both the git-completion.bash file and the git-prompt.sh file to get things working. Below is what worked for me.

if [ -f /opt/local/share/git-core/contrib/completion/git-completion.bash ]; then
. /opt/local/share/git-core/contrib/completion/git-completion.bash
fi

if [ -f /opt/local/share/git-core/contrib/completion/git-prompt.sh ]; then
. /opt/local/share/git-core/contrib/completion/git-prompt.sh
fi

Bash Version 4.x

As I was reinstalling ports I noticed some logging that flew by in the terminal stating something about a requirement to use Bash 4 for the bash completion functionality to work properly. So I decided to utilize the newer version of Bash installed by MacPorts and here's how:
  1. Add the path to the new bash (/opt/local/bin/bash) to /etc/shells
  2. Use the chsh utility to change the shell to the new bash: chsh -s /opt/local/bin/bash
  3. After closing the terminal and opening a new one, check the bash version using either of these methods:

    $ echo $BASH_VERSION
    4.2.42(2)-release
As long as the version displayed is the newer version from MacPorts, you should be ready to go.

Just for my own sake and in case I need it in the future, I'm going to list a number of items that I had to reinstall:


$ sudo port install git-core +bash_completion +doc +svn
$ sudo port install tig
$ sudo port install mercurial +bash_completion
$ sudo port install gnupg curl wget ncftp tree pstree watch screen proctools mtr cowsay
$ sudo port install postgresql90-server
For more info about installing and configuring PostgreSQL, see my post titled Installing PostgreSQL 9.0 on Mac OS X 10.6.8 via MacPorts

Bruce Snyder

About Bruce Snyder

Bruce Snyder has a unique skill set with a deep background in software architecture and engineering and the ability to liaise with the business side. With nearly 20 years of professional experience in enterprise and open source software, Bruce has a passion for creative problem solving, a strong work ethic and the ability to bridge the gap between business leaders and software development teams.

Bruce is a member of the Apache Software Foundation and has worked on several Apache projects. He has also authored books on Apache ActiveMQ, the Spring Framework, Apache Maven and Apache Geronimo, spoken at numerous software conferences and has helped to build communities around open source software.