Tag Archives: macports

Installing MacPorts on MAC OSX 10.6

Good times, installing MacPorts that is. This is the basis for unleashing the power of LINUX/UNIX/BSD in full, on your MAC OSX system. One of the utilities I’ve used most is wget. I makes short work of taking apart websites you think might be malicious, basically defanging them. Fun times! 🙂

Now, to get MacPorts installed was not small effort, compared to how MANY blogs and posts on the net make it sound. Well, I’m here to tell you that, you got here because those didn’t work, right? Well, maybe you came here first. If that’s the case, I’m going to save some some frustration.

Now, first things first, I’m going to tell you to unlock the root user on your computer. Look, before you become totally indignant, let me beat you to the punch. I’ve been there, done that. I’ve been a professional UNIX (real UNIX HP-UX and SGI’s IRIX, IBM’s AIX just to name a couple) for over 20 years. I don’t want to hear about how ‘bad’ or ‘dangerous’ it is running as root. Tough beans, I don’t care. I’m not a paranoid ninny, I’m a code cowboy. Deal with it. If you prefer, you can prefix all your commands with the less ‘scary’ sudo, but don’t whine to me if something in this post does not work. Not that I’d care anyway.

So, now that we understand each other, let’s move on.

Step 1 — check out the MacPorts source code

I stumbled across this suggestion here: [ Snow Leopard and MacPorts ]. Worked like a charm to get a hold of the latest MacPorts build.

Using svn (aka Subversion, a most detestable tool IMHO), get the source code and plop it down in /opt. This is how I did that.

reguser#: su -
root#: cd /opt
root#: svn co http://svn.macports.org/repository/macports/trunk/base/ macports-svn

Step 2 – build the package from source

OK, I might have lost a couple of your ‘click-to-install’ types with that, but really, as long as it does not nuke itself (you’ll see that happen in other blog articles I have) it’s very straight forward. Run the three commands to build the package, and viola… update your environment and.. bingo.. you’re onto installing your new packages! 🙂

Here is how it’s done. First, move yourself into the package you just checked out:

root#: cd macports-svn

Next, you’ll want to run the configure script to test your system’s capability to compile, and to generate the primary make file:

root#: ./configure

Compile and make the install package:

root#: make

Finally, execute the install:

root#: make install

Step 3 – set your LIBDIR path

That’s about all there is to it! Now, you’ll probably want to edit your ~/.bash_source file, adding the future path of all these cool libs. Believe me when I tell you, it can save you a lot of pain and bewilderment later one, when you’ve compiled those critical libraries and the application you really want to install insists that it cannot find them.

So, here is how I do it, open the file:

root#: vi ~/.bash_profile

Now add the line for LIBDIR to the file and save it. The other line there is helpful too, might as well toss it in, because it makes running port just that much easier.

export LIBDIR=$LIBDIR:/usr/local/lib
export PATH=$PATH:/opt/local/bin:/opt/local/sbin

Now, just editing the file does not do much, unless you reload your user environment (this happens on login, but only at login, so.. you’ll need to do it manually here, using the source operation. Really, it’s much easier than it all might sound.

root#: source ~/.bash_profile

Step 4 – update with the latest Portfiles

So, that’s all I had to do, to get the base MacPorts installed. Now, there are two more commands that you should run now, to make sure that your MacPorts install is all up to date, and registered. Do you need to run both, probably not. But I did, and it worked for me. Now, documentation says this will happen automatically. Didn’t seem to for me, so I ran them myself, just to be certain.

root#: port -v selfupdate
root#: port -r selfupdate

That should just about do it. Now you are ready to install fun extras like webget, libevent and eventually, Gearman.

Now, if you are really picky about your OS’d filesystem, you might go and remove the macports source you checked out. I, personally, hate having to track source code down again, so unless I’m out of disk space, I leave it for future reference.