changing macports install directory *after* installing
I have macports installed on one computer, and I was hoping to 开发者_开发问答just copy the entire /opt tree to another computer. Except, on the new computer (both are Intel Macs with Lion, so I am hoping to avoid recompiling all the packages) I have an extra hard disk, so I want to install macports on /Volumes/extradrive/opt
Can I copy the macports tree over from the old computer to the new computer and then change the directory path somewhere? I am guessing not, because all the software has been compiled expecting /opt. If so, can I recreate the entire macports on the new computer easily?
Yes, it is possible to maintain a single MacPorts /opt
directory on two machines and have one installation outside of /opt
, if they are both running the same version of OSX and XCode. The quick and dirty way that I do the same task on my own machines is:
rsync -arvz $macports_host_machine:/opt/ /Volumes/extradrive/opt/
where $macports_host_machine
is the machine on which MacPorts is installed (in /opt/
). Now, link /Volumes/extradrive/opt
to /opt
:
sudo ln -s /Volumes/extradrive/opt/ /opt/
I also perform this additional step
sudo chown -h username:group /opt
sudo chmod -h 755 /opt
to change ownership and permissions of the symbolic link.
After that, I maintain the /opt
directory on only $macports_host_machine
and rsync with all of my other machines (running the same version of OSX and XCode) periodically.
The previous instructions were written assuming that MacPorts was installed in /opt
on $macports_host_machine
, if MacPorts was installed in some other non-standard location, you should replace /opt
with whatever the installation path is on $macports_host_machine
精彩评论