using a local copy of a file instead of downloading it in macports

In some cases, macports can’t or should not download a file from internet. Instead, it should use an already downloaded local copy. Unfortunately, this use case is not supported, and a workaround is required.

Step 1:

Make a copy of the directory with Portfile (located somewhere in /opt/local/var/macports/sources/rsync.macports.org/release/ports)

Step 2:

Put the file into the directory

Step 3:

Modify Portfile, add:

set orig_dir [pwd]
fetch {
  set file "PyICU-0.8.1.tar.gz"
  file mkdir $distpath
  file copy -force ${orig_dir}/$file ${distpath}/${file}
}

Instead of “PyICU-0.8.1.tar.gz” write the name of your file.

Step 4:

Install

$ sudo port install -d -v

Leave a Reply