Quantcast
Channel: Planet Apache
Viewing all articles
Browse latest Browse all 9364

Bruce Snyder: Yak Shaving to Install Git Via MacPorts on OS X Lion

$
0
0


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. Below is the command I used:

$ sudo port install git-core +bash_completion +doc +svn

Unfortunately this wound up with an error stating:
Error: Failed to install zlib
Hunting 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. So below are the steps I took that finally solved the problem:
  1. Install the Xcode command-line tools from the Xcode preferences panel
  2. Update the /opt/local/etc/macports/macports.conf file to change from 'developer_dir /Developer' to just 'developer_dir'
  3. Clean all ports using sudo port clean all (this took a while)
  4. Now run sudo port install git-core +bash_completion +doc +svn (this took even longer)

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?

Viewing all articles
Browse latest Browse all 9364

Trending Articles