Index: src/pextlib1.0/Pextlib.c
===================================================================
--- src/pextlib1.0/Pextlib.c	(revision 73092)
+++ src/pextlib1.0/Pextlib.c	(working copy)
@@ -242,9 +242,14 @@
 int NextuidCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED)
 {
 	Tcl_Obj *tcl_result;
+	Tcl_Obj *tcl_min_usable_uid;
 	int cur;
 
-	cur = MIN_USABLE_UID;
+	tcl_min_usable_uid = Tcl_GetVar2Ex(interp, "min_usable_uid", NULL, 0);
+	if (tcl_min_usable_uid == NULL ||
+		Tcl_GetIntFromObj(interp, tcl_min_usable_uid, &cur) != TCL_OK) {
+		cur = MIN_USABLE_UID;
+	}
 
 	while (getpwuid(cur) != NULL) {
 		cur++;
@@ -259,9 +264,14 @@
 int NextgidCmd(ClientData clientData UNUSED, Tcl_Interp *interp, int objc UNUSED, Tcl_Obj *CONST objv[] UNUSED)
 {
 	Tcl_Obj *tcl_result;
+	Tcl_Obj *tcl_min_usable_gid;
 	int cur;
 
-	cur = MIN_USABLE_GID;
+	tcl_min_usable_gid = Tcl_GetVar2Ex(interp, "min_usable_gid", NULL, 0);
+	if (tcl_min_usable_gid == NULL ||
+		Tcl_GetIntFromObj(interp, tcl_min_usable_gid, &cur) != TCL_OK) {
+		cur = MIN_USABLE_GID;
+	}
 
 	while (getgrgid(cur) != NULL) {
 		cur++;
Index: src/macports1.0/macports.tcl
===================================================================
--- src/macports1.0/macports.tcl	(revision 73092)
+++ src/macports1.0/macports.tcl	(working copy)
@@ -46,7 +46,7 @@
         rsync_dir startupitem_type place_worksymlink xcodeversion xcodebuildcmd \
         mp_remote_url mp_remote_submit_url configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
         applications_dir frameworks_dir developer_dir universal_archs build_arch macosx_deployment_target \
-        macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip"
+        macportsuser proxy_override_env proxy_http proxy_https proxy_ftp proxy_rsync proxy_skip min_usable_uid min_usable_gid"
     variable user_options "submitter_name submitter_email submitter_key"
     variable portinterp_options "\
         portdbpath porturl portpath portbuildpath auto_path prefix prefix_frozen portsharepath \
@@ -55,7 +55,7 @@
         rsync_server rsync_options rsync_dir startupitem_type place_worksymlink macportsuser \
         mp_remote_url mp_remote_submit_url configureccache ccache_dir ccache_size configuredistcc configurepipe buildnicevalue buildmakejobs \
         applications_dir current_phase frameworks_dir developer_dir universal_archs build_arch \
-        os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target $user_options"
+        os_arch os_endian os_version os_major os_platform macosx_version macosx_deployment_target min_usable_uid min_usable_gid \$user_options"
 
     # deferred options are only computed when needed.
     # they are not exported to the trace thread.
Index: configure.ac
===================================================================
--- configure.ac	(revision 73092)
+++ configure.ac	(working copy)
@@ -225,9 +225,14 @@
 AC_SUBST(READLINE_LIBS)
 
 # Lowest non-system-reserved uid and gid (Apple claims <500)
-AC_DEFINE([MIN_USABLE_UID], [500], [Lowest non-system-reserved UID.])
-AC_DEFINE([MIN_USABLE_GID], [500], [Lowest non-system-reserved GID.])
+MIN_USABLE_UID=500
+MIN_USABLE_GID=500
+AC_DEFINE_UNQUOTED([MIN_USABLE_UID], ${MIN_USABLE_UID}, [Lowest non-system-reserved UID.])
+AC_DEFINE_UNQUOTED([MIN_USABLE_GID], ${MIN_USABLE_GID}, [Lowest non-system-reserved GID.])
 
+AC_SUBST(MIN_USABLE_UID)
+AC_SUBST(MIN_USABLE_GID)
+
 # Load tclConfig.sh
 SC_PATH_TCLCONFIG
 SC_LOAD_TCLCONFIG
Index: doc/macports.conf.in
===================================================================
--- doc/macports.conf.in	(revision 73092)
+++ doc/macports.conf.in	(working copy)
@@ -148,3 +148,8 @@
 # hosts not to go through the proxy (comma-separated, applies to HTTP, HTTPS,
 # and FTP, but not rsync):
 #proxy_skip            internal1, internal2, internal3
+
+# minimum UID/GID numbers for adduser/addgroup commands
+# UIDs/GIDs < 500 are reserved by Apple
+#min_usable_uid		@MIN_USABLE_UID@
+#min_usable_gid		@MIN_USABLE_GID@
