By jdipol on May 11, 2012
I needed to build a project on my MacBook that required GNU msgfmt. I could have built it from source, but instead I decided to install MacPorts in case I needed other open source type packages in the future.
Installing MacPorts is fairly straightforward, but the first thing you must do after installing the base image is synchronize with the MacPorts repository by running:
$ sudo port -d sync
That failed for me because MacPorts uses rsync to access its repositories, and I was sitting behind a firewall that requires the use of an HTTP proxy to get to the internet. Setting RSYNC_PROXY didn't help since (apparently) our proxy does not support rsync.
Fortunately there is an alternative. You can use Subversion to sync up with the repository content, and Subversion works over http. After making sure my HTTP proxy for svn was set (by checking my ~/.subversion/servers file). I followed the directions described in How to sync your ports tree using Subversion (over HTTP) with the following modification:
- Before checking out the initial copy of the ports tree I changed permission on /opt/local/var/macports/sources/trunk/dports to be owned by me (jdipol) and not root.
- I did the initial "svn co" as me and not root. This left the subversion workspace owned by me and not root.
Why did I do this? Because "port sync" runs svn to make sure the ports tree is up to date. It runs svn as the user that owns the subversion workspace. I wanted that to be jdipol to always pick up my subversion settings from ~jdipol/.subversion -- not from root's environment. So now even though I run "port sync" as root it still runs "svn update" as me.
And don't forget you must install Apple's Xcode even if you don't plan on doing any development. Why? Because MacPorts requires "make" to process some of the ports. So make sure you install Xcode including CLI commands:
- Install Xcode from the AppStore -- it's free
- Start Xcode
- Select Preferences->Downloads and install Command Line Tools
Once you do that, then you are ready to run:
$ sudo port -d sync
To get msgfmt all I needed to do was:
$ sudo port install gettext
If you want to see all the packages available to you, run
$ port list