- Install Xcode: Grab it from App Store
- Install Command line tools in xcode (open xcode -> Preferences -> Downloads -> Command Line tools)
- Install MacPorts: http://macports.org/install.php.
- Check MacPorts is installed. This will be a good test to see if MacPorts was installed properly:sudo port -v selfupdate.
If you're interested in how MacPorts works, consider reading the documentation for it here: http://guide.macports.org/.