Version 19 (modified by stig@…, 15 years ago) (diff) |
---|
Migrating a MacPorts install to a new major OS version or CPU architecture
An installation of MacPorts and the ports installed by it are only designed to work on a single OS release and a single CPU architecture. If you upgrade to a new OS version (e.g. from Leopard to Snow Leopard) or migrate to a new machine with a different type of CPU (e.g. PowerPC to Intel), you may get lucky and have your ports keep working, but in general, things will break.
Reinstall Xcode and MacPorts
After performing either of these types of system upgrades, you will first need to install the base MacPorts system again, either from the appropriate disk image or from source. If you are upgrading from a prior version of Mac OS X, install the latest version of Xcode for your new OS. This will not be done for you automatically; Xcode is not updated by Software Update, so you must update it manually. You will find the Xcode installer on the Mac OS X installation DVD or on the Apple Developer web site. Finally, reinstall all your ports.
Reinstall ports
To reinstall your ports:
- Save the list of installed ports:
port installed > myports.txt
- Uninstall all installed ports:
sudo port -f uninstall installed
- Clean any partially-completed builds and remove any archives:
sudo port clean --work --archive all
- Browse
myports.txt
and install the ports that you actually want to use (as opposed to those that are only needed as dependencies) one by one, remembering to specify the appropriate variants:sudo port install portname +variant1 +variant2 ...
Note that if you have specified variants which are not the default, you may need to install ports in an order other than the alphabetical order recorded in myports.txt
.
Automatically reinstall ports
If you want to do the whole procedure automatically instead, including handling dependencies, you can run the following commands to build a Makefile for running the reinstalls in the right order. (Not needed If you already ran the steps in the previous section.)
port installed |grep -v '^The following' | awk '{print $1}' > myports.txt
echo "all: $(cat myports.txt|tr '\n' ' ')" > Makefile.portsupgrade
for port in $(cat myports.txt); do echo "$port: $(port deps $port|grep Dependencies:|sed -e 's/.*Dependencies: *//;s/,//g'|tr '\n' ' ')" printf "\tport -f uninstall $port\n\tport install $port\n" done | tee -a Makefile.portsupgrade
make -f Makefile.portsupgrade