diff --git a/tools/osxcross-macports b/tools/osxcross-macports
index f008a8d..725fac1 100755
--- a/tools/osxcross-macports
+++ b/tools/osxcross-macports
@@ -306,20 +306,34 @@ getPkgUrl()
     verboseMsg "  $p"
   done

-  local pkg=$(echo "$pkgs" | \
-              grep "$pkgname-$pkgversion" | grep $OSXVERSION | grep $ARCH | \
-              uniq | tail -n1)
-  if [ -z "$pkg" ]; then
+  local allpkgs="$pkgs"
+  if [ $ARCH != "i386-x86_64" ]; then
+    pkgs=$(echo "$pkgs" | grep -v universal)
+  fi
+
+  while [ -z "$pkg" ] && [ -n "$pkgs" ]; do
     pkg=$(echo "$pkgs" | \
-          grep "$pkgname-$pkgversion" | grep $OSXVERSION | grep "noarch" | \
+          grep "$pkgname-$pkgversion" | grep $OSXVERSION | grep $ARCH | \
           uniq | tail -n1)
-  fi
-  if [ -z "$pkg" ]; then
-    pkg=$(echo "$pkgs" | grep $OSXVERSION | grep $ARCH | uniq | tail -n1)
-  fi
-  if [ -z "$pkg" ]; then
-    pkg=$(echo "$pkgs" | grep $OSXVERSION | grep "noarch" | uniq | tail -n1)
-  fi
+    if [ -z "$pkg" ]; then
+      pkg=$(echo "$pkgs" | \
+            grep "$pkgname-$pkgversion" | grep $OSXVERSION | grep "noarch" | \
+            uniq | tail -n1)
+    fi
+    if [ -z "$pkg" ]; then
+      pkg=$(echo "$pkgs" | grep $OSXVERSION | grep $ARCH | uniq | tail -n1)
+    fi
+    if [ -z "$pkg" ]; then
+      pkg=$(echo "$pkgs" | grep $OSXVERSION | grep "noarch" | uniq | tail -n1)
+    fi
+
+    if [ $ARCH != "i386-x86_64" ]; then
+      pkgs="$allpkgs"
+      allpkgs=""
+    else
+      pkgs=""
+    fi
+  done

   verboseMsg " selected: $pkg"

