Q: Transfering list of installed ports to a different machine?

Kevin Ballard eridius at macports.org
Thu Jan 4 12:46:25 PST 2007


On Jan 4, 2007, at 3:12 PM, Ralf Graf wrote:

> I'm in the process of moving my stuff from my good old G4-Powerbook  
> to an all shiny new MacBook Pro. I wonder wether it's possible to  
> take over my installed ports from the Powerbook to the MacBook Pro.  
> Simply copying /opt/local shouldn't work, because the installed  
> ones are all PPC-Binaries.
>
> Is there a way of rebuilding the same list of ports without the  
> need to hack every port that "port installed" listed on the old  
> machine into a terminal on the new machine?
>
> I may sound confusing, to make clear what I'm searching for,  
> something like:
>
> Old machine: ports installed > list_of_ports.txt
> New machine: ports install < list_of_ports.txt

Unfortunately, no.

You can, however, write a fairly simple script to get a list of all  
ports and variants in a form that you can send to port. There are a  
few caveats, however - ports that are outdated, you'll end up  
installing the latest. Inactive ports will cause a problem, because I  
know of no way to install a port without activating it. Also, ports  
which have dependencies may also be a problem, because if you have  
the dependencies installed with specific variants, it's non-trivial  
to detect this and ensure those dependencies are installed with those  
variants before the dependent port.

That said, this should work to simply install all ports and their  
variants on the new machine:

## old machine
# this line will skip inactive ports
port installed | sed -nE -e '/^  .*\(active\)$/{s/^  //;s/@[-a-zA- 
Z0-9_.]+//;s/ \(active\)$//;p;}' > ports.txt
# use this one instead if you want to install all ports, even  
inactive ones
#port installed | sed -nE -e '/^  $/{s///;s/@[-a-zA-Z0-9_.]+//;s/ \ 
(active\)$//;p;}' > ports.txt

## you may want to peruse the ports.txt list to ensure dependencies  
with custom variants
## are listed above any dependent ports

## new machine
cat ports.txt | xargs -L 1 port install

HTH,
Kevin Ballard

-- 
Kevin Ballard
http://kevin.sb.org
kevin at sb.org
http://www.tildesoft.com


-- 
Kevin Ballard
http://kevin.sb.org
eridius at macports.org
http://www.tildesoft.com


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.macosforge.org/pipermail/macports-users/attachments/20070104/666356b4/attachment.html


More information about the macports-users mailing list