Tuesday, June 28, 2011

Building atlas on macports takes forever - try disabling spotlight indexing

Last night I was trying to upgrade all my installed MacPorts programs to the latest versions, using the command

sudo port upgrade outdated

I noticed that the process seemed to take an incredibly long time building atlas. It got to this stage and nothing happened.


--->  Computing dependencies for atlas
--->  Building atlas

I left it for an extremely long time, however (>6 hours), and atlas still failed to build (1). I have a pretty fast 15" MacBook Pro (6,2 - 2.53 GHz Core i5 (dual core)), so this was surprising.

I ctrl-c'd and tried again, thinking that something might have gotten stuck. Then re-ran with the same results - build seemed to go hours without completing.

Then I noticed in Activity Monitor that none of the compile processes were actually taking much CPU. Something that was taking up CPU was mdutil, a process that does spotlight indexing.

So I disabled spotlight indexing using the following command (2):

sudo mdutil -a -i off
Afterwards things proceeded as I expected - the compile processes started taking up large amounts of CPU, and the atlas build finished within the hour.

It might not be related, but if your atlas build takes forever, give this a shot.



1) Similar issue that no one really had a solve for:

https://trac.macports.org/ticket/27600


2) Disabling spotlight:

4 comments:

  1. Disabling spotlight during heavy builds is a good idea. I do this temporarily with aliases:

    jd:duvel/~/ which spot
    spot: aliased to sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist
    jd:duvel/~/ which spotLess
    spotLess: aliased to sudo launchctl unload /System/Library/LaunchDaemons/com.apple.metadata.mds.plist


    It is not the cause of the prolonged atlas compile though.
    One cause is that it can not be parallel build considering the setting in the port file:
    use_parallel_build no

    I timed my atlas compile to about 4 hours on an 8 core and it succeeded.

    ReplyDelete
  2. Thanks for the tip, Jurgen!

    It's a bit strange that my compile proceeded so normally after disabling spotlight, but that may have just been a coincidence.

    ReplyDelete
  3. I had a similar problem building qt4-mac. In the spotlight preferences I added /opt/local/var/macports/build to the directories not to index and the macbook pro is no longer in danger of melting its CPU. I'm trying to be a good mac citizen by letting spotlight do its thing but it seems pretty terrible to me in general.

    ReplyDelete
    Replies
    1. Note, to get to /opt in the spotlight preferences I needed cmd-shift-G. Also, you can tell macports "build.jobs=1" to stop it from multithreading the build, if your priority is not melting the computer rather than building as fast as possible.

      Delete