Friday, January 14, 2011

How to maintain a macports installation

I've used the apt family of package managers for some time and started using macports last year when I got a laptop. I'm at a bit of a loss at the best way to keep packages up-to-date though, and any other maintenance tasks I should be looking out for.

My question is, beside periodically using port upgrade on specific packages, what is the workflow for getting regular security and package updates?

  • The easiest way to find out what packages are out of date is to run port outdated. I'm not aware (and couldn't find when researching my facts) of an RSS feed or something similar to let you know when ports are updated. However you could run a script every week or something similar to check to see what is outdated and let you know.

    Personally I check my port installations once a month or so manually.

    Nerdling : How do you update the list of outdated ports? `port selfupdate`
    Chealion : I run `sudo port upgrade outdated`
    From Chealion
  • Every week or two, I do

    port selfupdate
    port upgrade installed
    

    This is basically the equivalent of

    apt-get update
    apt-get upgrade
    

    if you are familiar with Debian/Ubuntu.

    From Josh K
  • I run the following

    port -v sync # sync the latest definitions
    port -v outdated # see what's outdated
    port -v upgrade outdated # upgrade what's outdated
    

    You can run

    port -v selfupdate
    

    every so once in a while to upgrade the MacPorts software itself. It's only infrequently updated, so I only do this when I know there is a new release.

    Dana the Sane : Thanks, I tried out your method. The compile is taking forever after 10 months of no updates though :-\
    Blair Zajac : You don't mean the compile, but the update check? If you don't have many ports installed, then you won't see many updates. Also, not all packages update frequently. Also, you could subscribe to an RSS feed off of commits to see what packages have been updated http://trac.macports.org/timeline
    Dana the Sane : I have a fair number of ports installed to make my system closer to a recent linux distro. The compile ended up taking at least 12 hours.
    Nerdling : There's no harm in always running selfupdate in place of sync.
  • Sync and update if newer version of MacPorts itself is released.

    sudo port -v -d selfupdate
    

    List new packages

    port outdated
    

    Update all packages

    sudo port -v upgrade outdated
    

    After update old versions are not removed but set "inactiv". To clean up:

    sudo port -v uninstall inactive
    

    From time to time I run this. It cleans up downloads and left over files from previous builds.

    sudo port clean -f --all "*"
    
    Nerdling : If you happen to use archive mode, clean --all is probably not something you want to use.
    From Paidhi

0 comments:

Post a Comment