Yak Shaving to Install Git Via MacPorts on OS X Lion

Today I needed to set up a new MacBook Pro and as such one of the tasks was to install git on OS X Lion. Being that I am a fan of MacPorts, I decided to start there but I ran into some strange errors. Unfortunately I wound up doing a lot of yak shaving.
The last time I installed MacPorts fresh, it was on a previous MacBook Pro that had OS X Snow Leopard installed. I successfully installed MacPorts and then used the port utility to install git without issue. Later I then updated to OS X Lion and had no issues with git or Xcode.
So from previous experience, I knew that before I could install MacPorts I would need to install Xcode, so I downloaded and installed Xcode 4.3 from the App Store. Then I attempted to install MacPorts, but began seeing errors about not being able to find the make utility. Sure enough, it was not in /usr/bin. After some hunting, I ran across a document titled New Features in Xcode 4.3 which noted the following:
'The command-line tools are not bundled with Xcode 4.3 by default. Instead, they can be installed optionally using the Components tab of the Downloads preferences panel...'
So I installed the command-line tools from the Xcode preferences panel and then proceeded with the MacPorts installation. It completed successfully so I moved on to the actual installation of git using the following command:
$ sudo port install git-core +bash_completion +doc +svn
Unfortunately this wound up with an error stating:
Error: Failed to install zlibHunting around, I wound up finding a few things such as this MacPorts issue, only to discover that this issue was closed as invalid. So I hunted some more and found this question on Stack Overflow which had one hint but not everything to fix the situation. I also found some advice in a document about Migrating a MacPorts install to a new major OS version or CPU architecture.
- Install the Xcode command-line tools from the Xcode preferences panel
- Update the /opt/local/etc/macports/macports.conf file to change from 'developer_dir /Developer' to just 'developer_dir'
- Clean all ports using sudo port clean all (this took a while)
- Now run the following steps:
$ sudo ln -s /Developer /
$ sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs /SDKs
$ sudo xcode-select -switch /Applications/Xcode.app
$ sudo port install git-core +bash_completion +doc +svn
After stumbling upon and utilizing these steps, I completed my yak shaving session and finally got git installed successfully. This cost me a total of about two hours. Here's a great Ren and Stimpy video about yak shaving. Now I'm on to another weird problem with this new laptop, a couple of System Preferences are dimmed and I can't figure out why. Anybody know what may be causing this?About Bruce Snyder
Bruce Snyder is a veteran of enterprise software development and a recognized leader in open source software. With over a decade of experience, Bruce has worked with a wide range of technologies including Java EE, Enterprise Messaging and Service Oriented Integration. In addition to his role as a senior software engineer at SpringSource, Bruce is also an Apache Member, a co-founder of Apache Geronimo and a developer for Apache ActiveMQ, Apache Camel and Apache ServiceMix. He is the co-author of Professional Apache Geronimo, Beginning Spring Framework 2 both from Wrox Press and is currently co-authoring ActiveMQ In Action for Manning Publications. Bruce also serves as a member of various JCP expert groups and is a recognized international speaker at industry conferences. Bruce lives in beautiful Boulder, Colorado with his family.
More About Bruce »Northern Virginia Software Symposium
November 1 - 3, 2013
Reston, VA
Current Topics on the NFJS Tour
- Core Java, JEE
- Dynamic Languages: Groovy, JRuby, Scala, Clojure
- RESTful Web Apps
- Frameworks: Hibernate, Grails, Spring, JSF, GWT, more
- Agility
- Test Driven Design
- Security
- Ajax, Flex, RIA
Why Attend the NFJS Tour?
- » Cutting-Edge Technologies
- » Agile Practices
- » Peer Exchange
Current Topics:
- Languages on the JVM: Scala, Groovy, Clojure
- Enterprise Java
- Core Java, Java 7
- Agility
- Testing: Geb, Spock, Easyb
- REST
- NoSQL: MongoDB, Cassandra
- Hadoop
- Spring 3
- Automation Tools: Git, Hudson, Sonar
- HTML5, Ajax, jQuery, Usability
- Mobile Applications - iPhone and Android
- More...
NFJS, the Magazine
May Issue Now AvailableOn the road to learning
by Raju GandhiRefactoring to Modularity
by Kirk KnoernschildRESTful Groovy
by Kenneth KousenGetting Started with D3.js
by Brian Sletten