Moving homebrew installs to a new Mac

Our siblings pebblecode posted a good article last week that’s relevant here too.

Moving homebrew installs to a new Mac by George Ornbo:

You are a homebrew user and you have a new Mac. If you don’t want to use Apple’s migration tool to copy over everything you might be faced with running brew install [formula] for everything you have installed.

Unless you have a spare afternoon to do this you can achieve the same things with a few commands and be done in minutes, leaving you to get on with something more interesting.

On your old mac you can output a list of installed software from homebrew.

brew list

By piping this into a file you can create a text file containing all of your installed software.

brew list > homebrew.txt

Now you can copy this to your new Mac by Airdrop if you are on the same network, scp or using a cloud service.

Once you have the file on your new Mac and assuming you have homebrew setup you can install all of the software with a single command

cat homebrew.txt | xargs brew install

You might find that homebrew has removed some formulae since you installed it. If this is the case just edit the file and remove the formula that is no longer available.

If you have your dotfiles in git repository you’ve suddenly got a pretty portable setup.

Quick tip: Google Drive download links

If your company uses Google Apps or your just a fan of Google services, then you’re probably using Drive as your cloud file syncing tool.

When you want to share those files with others, you can specify who has access and grab a link via Sharing Settings. However, click that link and you’ll find that for many file types, instead of the browser downloading the file, the Google Drive viewer is displayed. For example, a .ZIP archive:

ZIP archive in Google Drive viewer

One can click File > Download (⌘S) on this page but it becomes a 2-step operation. In order to directly download a file, we have to tweak the link.

The Link to share for my file is:

https://docs.google.com/a/pebbleit.com/file/d/0B05UA09uJtEDNjRPNURtbEk3MWM/edit?usp=sharing

The penultimate part of the URL, 0B05UA09uJtEDNjRPNURtbEk3MWM, is the file’s ID. Add it to the end of https://drive.google.com/uc?export=download&id= to create a link that will directly download the file:

https://drive.google.com/uc?export=download&id=0B05UA09uJtEDNjRPNURtbEk3MWM

Hopefully Google will add this feature soon so this manual tinkering will no longer be required.

(Source: webapps.stackexchange.com)

Quick Tip: ImageOptim

If you share images on the web, via email or any other means, help yourself and your audience out by running PNG, JPEG or GIF files through ImageOptim first.

ImageOptim window screenshot

ImageOptim, as the name implies, optimises images by processing them with a number of open source tools. I’ve often seen file size reductions of 20-30%. A saving not to be sniffed at when in comes to disk space and load times.

As well as single files, the application can batch process multiple files or whole folders of images. And you can also install the system service to run directly from Finder’s contextual menu or invoke via keyboard shortcut.

ImageOptim service screenshot