Tag Archives: osx

Is your Chrome bigger than mine? How Chrome ate 21GB of storage

I’ve been playing with the macOS Sierra Golden Master for a few days and ran into the new storage optimization app that is now included in macOS. It prompted me that I was running low on disk space, and displayed the following dialog. The first item on the list was a bit shocking:

chrome-21gb

How could Chrome be using 21GB of my precious SSD space?!

I quickly looked at the configuration for Chrome’s cache, which was fine. Then I jumped on Google and found the problem. Chrome had not been deleting previous versions of itself after automatic updates. I had versions 14.0.835.202, with a creation date of September 29th 2011, all the way to 53.0.2785.116, which was a couple of days old. That’s a lot of Chrome!

so-much-chrome

Turns out this is a known issue, but getting a fix out, or at the very least prompting the user about a problem, has been dragging along for years. The root of this sneaky bug is bad permissions on one file, that’s preventing the updater to work correctly.

chrome-perms

Silent errors make for great user experience!

I’m happily walking away from this with an extra 21GB in my pocket! And now I ask you: is your Chrome bigger than mine?

 

UPDATE: To be fair to the Chrome devs, I should point out that, according to the bug report linked above, the permissions problem is caused by 3rd party plugin installers that run as root and modify the Chrome application bundle. They mention DivX as the probable culprit, which makes sense since I had Chrome versions dating back to 2011. This leaves the question of how Chrome should deal with the situation. I think anything from a warning to a privilege elevation prompt would be much better than a silent failure.

More comments:

Hibernating in OSX Lion

In OSX Lion (might also be the case for older versions to), there is no direct way to hibernate a laptop except running out of battery power. The only available option is sleep, which will wake from memory; so it keeps draining the battery. It is possible to change this default behavior with the utility pmset. From the man page:

So by default, the system uses hibernatemode=3. All we need to do it change it to 25 and the sleep function will hibernate the computer:

Don’t forget to change it back to 3 to get the default behavior back.

Restore sparsebundle extended attributes after rsync

If you rsync a sparse bundle to another Mac without the -E flag (or if you copy it to a non Mac system), you will loose the ability to double click on it in the Finder to mount it. This is because the extended attributes telling the Finder the folder is actually a bundle are lost in the transfer.

The following piece of code I found here fixed the problem for me. Simply compile and run the code giving the path to the bundle in parameter and it will restore the attributes.

Make OSX’s top behave like Linux’s top

OSX’s top program doesn’t quite behave like its Linux counterpart out of the box. For me, the two biggest problems are that processes aren’t sorted by CPU usage and the top program itself uses 10% of the CPU because it calculates all sorts of statistics about memory and shared library usage that I personally don’t care about.

There are a series of flags that you can pass to OSX’s top to have its behavior be closer to Linux’s top. I have created the following alias to that effect :

The display is updated every second, processes sorted by CPU usage and no unnecessary statistics are calculated. Instead of 10%, top uses only 2% of the CPU.

Using filemerge for mercurial diffs

A friend of mine found a script that brings up OSX’s FileMerge program instead of the text-based file comparisons you get with mercurial with doing an “hg diff”.

  1. download this script and make sure its location is in your PATH
  2. add the following to .hg/hgrc:
  3. Now type hg opendiff <filename> (hg op is enough), instead of hg diff <filename>


Source

SQLite3, php5 and MAMP

The version of php5 bundled with MAMP doesn’t come with sqlite3 support built-in out of the box. Here’s how to add it, considering the following setup :

  • SQLite3 installed through MacPorts
  • php5 used through MAMP

I used the php-sqlite3 extension. When you run phpize, make sure you are actually using the one from MAMP by calling it with its full path  /Applications/MAMP/bin/php5/bin/phpize.

I then complied the extension with the following flags (both paths are the defaults for macports and MAMP) :

The make install didn’t copy the librarie to the right php folder :

Make sure that folder is the right one. You can find your dynamic extensions folder in your php.ini file.

Shrinking sparse bundle images

A sparse bundle image in Mac OS X will grow as you add files to it but never shrink if you remove files inside of it. To reclaim the disk space, you must run the following command :

If your account is protected with FileVault, this is done automatically for you when you logout of your account.

Useful free Mac apps

I’m a relatively new Mac user so I’m keeping a list of some useful free apps that I’m using on my Mac. It’s a work in progress…

  • Instant Messaging : Adium
  • PDF Annotation : Skim
  • Notes taking : Freemind
  • Linux package manager : Macports (lots of my friends use fink)
  • EquationService : Create equations from latex that can be used in Keynote
  • MacFUSE : MacFUSE is software that allows you to write arbitrary file systems as user-space programs
  • Creative MP3 Player support : XNJB
  • OSX Ext2 Filesystem
  • Switch : Audio file converter
  • Cyberduck : SFTP/FTP
  • Espérance DV : Create a ramdisk

Compile against libraries installed with MacPorts

MacPorts installs packages in a non unix-standard location. This can cause problems when trying to compile other software against these packages because they aren’t found by the configure script.

I experienced that problem when trying to compile SDL_image, which depends on libraries such as libpng. I had to configure with the following flags :

which indicates in which folders the libraries installed with MacPorts were installed.