Trouble with Local Port

Ryan Schmidt ryandesign at
Thu Aug 18 11:03:41 PDT 2011

On Aug 18, 2011, at 11:53, Nathan Brazil wrote:

> I maintain a re-distributable package of the Freeciv game that is built using MacPorts and then packaged for re-distribution.
> What I have been doing successfully prior to Lion & MacPorts 2 is create an alternate port install (rooted at /opt/com.bitaxis), create a local port repository, copy the Portfile and patch file into it, edit, build, and package.  The local port repository bit is needed because the official port often lags behind most the current version.
> Now, with Lion (10.7.0) and MacPorts 2.0.1, I run into the following issue when I try to install Freeciv 2.3.0 (the official one is still at 2.2.7) after I've edited the local Portfile:

I've updated freeciv and freeciv-x11 to 2.3.0 in r82697; thanks for letting us know this version is available. These ports have no maintainer, which is why they don't get updated in a timely manner. Would you be interested in maintaining these ports for us and submitting updates as needed?

> $ sudo port fetch freeciv-x11
> Error: Unable to execute port: could not read "/Users/nathan/Documents/Projects/ports/games/freeciv-x11/Portfile": permission denied
> To report a bug, see <>
> Okay.  This is different.  It used to write to the system location.  But, moving along...

It's talking about trouble reading from your portfile, not about writing to a system location. MacPorts 2 by default runs as the macports user, not as root; perhaps the macports user does not have permission to read the portfile, or more likely, one of the directories leading up to it.

> $ port fetch freeciv-x11
> Warning: MacPorts running without privileges. You may be unable to complete certain actions (e.g. install).
> Portfile changed since last build; discarding previous state.
> --->  Fetching freeciv-x11
> --->  Attempting to fetch freeciv-2.3.0.tar.bz2 from
> $ sudo port install freeciv-x11
> Password:
> Error: Unable to execute port: could not read "/Users/nathan/Documents/Projects/ports/games/freeciv-x11/Portfile": permission denied
> To report a bug, see <>
> Okay.  Maybe it will install to my home directory.

But you said you've configured MacPorts to install to /opt/com.bitaxis. So that's where it's going to install. Not into your home directory.

> $ port install freeciv-x11
> Error: Insufficient privileges to write to MacPorts install prefix.

If you don't use "sudo", then it's going to run as your user "nathan". Does "nathan" have permission to write to /opt/com.bitaxis?

> I checked the Unix permissions on my local port repository, and it looks like this:
> $ ll ~/Projects/ports/games/freeciv-x11
> total 8
> 0 drwxr-xr-x  5 nathan  staff   170B Aug 18 09:12 ./
> 0 drwxr-xr-x  4 nathan  staff   136B Apr  3 13:54 ../
> 4 -rw-r--r--  1 nathan  staff   1.5K Aug 18 09:12 Portfile
> 0 drwxr-xr-x  3 nathan  staff   102B Aug 18 08:53 files/
> 4 lrwxr-xr-x  1 root    staff   109B Aug 18 09:07 work@ -> /opt/com.bitaxis/var/macports/build/_Users_nathan_Documents_Projects_ports_games_freeciv-x11/freeciv-x11/work

Yes, but what about the directories leading up to this directory? I suspect a parent directory like /Users/nathan itself is restricted to only being readable by the user nathan (and of course root).

More information about the macports-users mailing list