moving macports to a different location

Puneet Kishor punk.kish at
Tue Sep 13 11:12:51 PDT 2011

On Sep 13, 2011, at 12:29 PM, Arno Hautala wrote:

> On Tue, Sep 13, 2011 at 11:54, Puneet Kishor <punk.kish at> wrote:
>> I was hoping to simply copy the /opt tree to the new computer. However, the iMac has two disks, and I want to set up macports on /Volumes/extradrive/opt. My question -- can I, should I do this, and how?
> You could certainly copy the full file tree to the new location and
> then edit etc/macports/macports.conf to update the relevant paths. One
> issue that I could see croping up is if there are any absolute paths
> that have been compiled into installed software. I'll leave it to
> someone else to comment there. I'm sure this isn't a supported
> process.
>> If not, is there an easy way I can recreate all the packages from my MBA on to my iMac without having to install each one separately?
> I was going to suggest installing from the software archives that
> exist on the MBA, but MacPorts always compiles from source if you're
> using a non-standard prefix.

I figured out a way (and am in the middle of setting it up, so will know its success in a couple of hours). Here is what I did --

1. MBA$ port -qv installed > myports.txt
2. copy myports.txt to the iMac
3. iMac ~/src/MacPorts-2.0.3$ ./configure --prefix=/Volumes/extradrive/opt/local && make && sudo make install
4. postflight setup (paths and all)
5. iMac ~$ sudo port selfupdate
6. iMac ~$ curl -O
7. iMac ~$ chmod +x restore_ports.tcl
8. iMac ~$ ./restore_ports.tcl myports.txt (myports.txt copied from MBA)

> Why do you want to use the extra drive for MacPorts? There may be a
> better solution than what you're asking for.

Because I got my iMac with an SSD and a 2 TB drive. The OS is on the SSD, and all other data (including my home folder) are going on the hard disk.

But, now I am thinking maybe I should actually revert back to macports on /opt/local. The only thing is, macports defaults to storing db data (for example, MySQL and PostGres) under /opt/local/var, and I didn't want that data on the SSD. I guess, I could still have macports on the SSD and have the db data on the external drive, and just tell the db software to use the different directory.


> -- 
> arno  s  hautala    /-|   arno at
> pgp b2c9d448

More information about the macports-users mailing list