Wednesday, June 27, 2012

Taming Lion

(image credit : )

Last weekend I went to a mall and was playing with an iMac - what a beauty it is. Apps were loading with one click and they looked beautiful on a gorgeous display. 

I got home and checked my 13" Mac book pro which is nearing its complimentary 1 year warranty  ( debating whether to bite the expensive Apple Care or going Commando ). It was slow. Really slow. I longed for the spiffy machine I once used to have.

This put me on a hunt and meanwhile set up development environment in Windows and worked on it for a day to see how things are.

Here is the bitter truth - Apple Fans - OS X Lion sucks at Memory Management. The net is ablaze with cribs and complaints on how poorly Lion manages memory - inspite of Macs being blessed with super powerful processors and enormous amount of RAM.

Still I would vote OS X Lion to be the best in class for Productivity and by the amount of things one can get done all under one roof.

I could not work in Windows - even though it was blazingly fast and responsive - could not get used to the shortcut keys ( in spite of swapping the Control and Windows key ), kept rotating the monitor on some combinations, no quick look, Alt-tabbing was painful, no full screen... and most of all - there is no CLI. ( No - cygwin is not a CLI )

I got back to Lion and tamed it ( or rather Lion tamed me ). 

Here is a list of things I did to get back in shape - use it at your own peril.

1. Run as many apps as possible in 32 bit mode.

Do a Get Info ( Command-I ) on the program in Applications and choose 32 bit mode. Its a shame isn't it - but it reduces memory footprint

iChat didnt launch in 32 bit mode. I switched to Sparrow - so not sure of the benefits / effects of Mail.

2. Remove all fancy icons from the menubar.

Here is a screenshot of my menubar - only Spotlight icon is there - couldn't remove it.

No Volume control, no Network Icon, no date and time ( useless since calendar never opens anyway ), no blue tooth icon, no display icon ( why did I ever have it there? )

The reason is to tame a process called SystemUIServer. This grows and grows and hogs almost a Gig of RAM. Now you can always kill it and recover some memory - but removing all the icons from menubar keeps this one at bay.

There are other benefits -  it is like being in a Zen like state - no distractions and if I want to know the time I do a date command on terminal.. feel like a true geek.

3.  Inactive Memory

This keeps creeping up and suddenly it would have taken more than a Gig - and what does it do - Heaven Knows ( Steve you there? ). Anyway there is a nice command "purge" - run it - system freezes for a moment and then you get back some free RAM.

Here is the before and after of running Purge - ( like those Gym Ads). Btw - this is the Activity Monitor icon tracking the Memory usage - what a nice idea Sirjee to use icons as indicators.

Did you see the Green ( Free Memory ) just eat into the Blue ( Inactive useless Memory ) - almost 600MB got recovered.

Now I work with activity monitor pie chart always on. When the green disappears I either run Purge or close down some unused Applications.

4. Close down everything

From the beginning of time - OS X does not quit when you close an application - it only closes the window. And these processes sit quietly eating 100+ MBs.. and these add up. Now I am retraining myself to do more of Command Q instead of Command W.

5. Turn off unwanted features - everywhere

The bloatware called iTunes has a social networking module, a sharing module, a DJ module, a Genius Module.... and so many which I never use - turned off all of them. Also shutdown dashboard, spotlight ( I am used to spotlight so not sure how i will fare ). Also turned off fancy animations etc. - even though we have been brainwashed into believing that GPU is the one that does all the GUI work - I refuse to believe this BS anymore - Lion is seriously broken.

There are 2 processes which will start hogging memory like crazy - LoginWindow and UserEventAgent and you will need to keep an eye on these 2 culprits and closing unwanted applications and turning off unwanted modules is the key I guess.

6. The Strange story of coreaudiod

Go ahead take a look at the CPU usage of coreaudiod - it will be singing why this Kolaveri D right now. It was using some crazy number like 50% and at times shot up to 120% ( I dont understand % more than 100 ).

Restarting it will jump right back to the crazy processor usage numbers. Folks at Apple Support forums advised to plug a headphone into the socket, some said remove Ambient noise reduction. I stopped the notifications sound also. Still no luck.

Then I started iTunes and the process dropped! Weird ! Now iTunes was consuming some crazy RAM - so I shut down and coreaudiod made a brief appearance and went away to its nice 0.0% usage.

7. Some good habits

I will be shutting down the laptop every night before going to sleep.
I will run the nice jobs Onyx has.
Will also not run anymore fancy apps ( Better touch tool you are an exception ).
I would also burn the installer to a DVD - i do not have the bandwidth to download 4GB - so I am unable to do a fresh clean install.

So thats it - looking forward to Mountain Lion and hopefully someone in Apple Team is working his Apple off in fixing the Memory issues.

And as we were speaking - my free memory has dropped to just 13 MB ( almost 4GB is being eaten up ). iTunes is now fighting for the crown.. ugh.Time to kill this sucker and run purge... all for the love of OS X.. sigh.