2

My recent upgrade to Yosemite (from Mavericks) took about 6 hours, nearly all of which time was used in processing the contents of /usr/local (e.g. TeX, etc.).

What is the upgrade process doing with these files that takes so long? Could I accelerate future updates by simply backing up these files, clearing the directory, and copying them manually after the update, or is the update process doing something critical with them?

1 Answer 1

2

The problem is only accute if you have a lot of files in /usr/local -- a few hundred files is not a problem. It needs to be many thousands of files. The reason, according to this post, is:

Part of the upgrade involves moving /usr/local out of the way. The process of moving those files back after the upgrade is done one file at a time and seems very slow.

He goes on to recommend removing anything from your Homebrew installs that isn't currently necessary with the brew remove; brew cleanup command pair. You can also move it aside, temporarily, naming it something like /usr/local.mine and then move it back after the update -- though this can make working with your Mac slightly problematic if you've, for example, switched your default shell for your account to be the Homebrew-supplied zsh or something like that.

Personally I opted to clean up my Homebrew installs. I also removed any Homebrew-installed daemons (MySQL, PostgreSQL and Redis) completely and shut them down. They're easy enough to get back after the installation is complete. In the end I had only a handful of Homebrew packages installed still that were very essential to me and the installation time wasn't too bad -- about 2 hours on an old iMac.

Of course, you can also wipe everything and just start again. First save everything you have installed:

brew list | sed s/\s+/\\n/g | tee my-brew-packages.txt

And now remove them all with:

cat ~/my-brew-packages.txt | xargs brew remove --force
brew cleanup --force

And to re-install things after you've updated:

cat ~/my-brew-packages.txt | xargs brew install
4
  • So basically they're just being moved around, not examined or tweaked, so I could delete and restore myself to save time (next time)! TeX alone had thousands of files (it seems).
    – orome
    Oct 22, 2014 at 1:47
  • You can definitely remove it all and re-install after the upgrade. For the most part there should be no customizations in /usr/local itself for Homebrew packages. All that stuff lives in your home directory. I'll update the answer with some information on saving and restoring a Homebrew install.
    – Ian C.
    Oct 22, 2014 at 1:51
  • For me the issue is TeX (via MacTeX), Git, and Python (managed with pip).
    – orome
    Oct 22, 2014 at 1:53
  • See my updates. I'd just brew remove them and then brew install them when you're done. Don't forget to run brew cleanup after brew remove is done.
    – Ian C.
    Oct 22, 2014 at 1:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .