Fix Any Mac Port Errors.

Sometimes Macport has problem to update or upgrade or install software. Most of the time, I have no clue how to fix the problem. But there is a universal method to solve the trouble.

Build a BASH script as below, and run it when you don’t use the Mac. It will cost a few hours.

########################################

port -qv installed > myports.txt  #record installed software
sudo port -f uninstall installed    #uninstall all of them
sudo port clean all
curl -O https://svn.macports.org/repository/macports/contrib/restore_ports/restore_ports.tcl
chmod +x restore_ports.tcl
sudo ./restore_ports.tcl myports.txt #re-install the previous software.

###########################################

The method is cited from https://trac.macports.org/wiki/Migration. It has a known problem “One known issue is that the script will fail if there are conflicting ports in the list. It’s possible to have conflicting ports installed provided at most one of the conflicting set is active. If the script fails for this reason, you can delete one of the conflicting ports from myports.txt and then simply run the script again. You may need to do this multiple times if there are multiple conflicting ports listed.”. But I never met before.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s