All posts in “Apple”

Snow Leopard’s Clang

clangI wasn’t aware of Clang and the transition to Low Level Virtual Machine compiler infrastructure. I knew about LLVM, but never saw a roadmap of Apple’s transition until I read the always excellent Ars Technica OS X Review. I’m just now setting up my development environment and was very tempted to use Clang to compile everything. At the moment, I’m pressed for time so I don’t want anything to go wrong. The 64-bit Apache/PHP tutorial is working great so far under Snow Leopard (just find the more recent version of the projects and tools).

If you want to set up Clang as your default compiler, throw this in your /etc/bashrc:

export CC=clang
export CFLAGS=-Qunused-arguments
export CPPFLAGS=-Qunused-arguments
export PATH=/Developer/usr/bin:$PATH

Anyway, I will eventually get around to recompiling with Clang and will report on my results. The first project will be Shiretoko and/or Namoroka.

Thanks for the tip Ajay Kapal.

You should follow me on twitter here.

Pulling Content Out Of OS X Cache.db Files

I’m not sure when, but most likely when Leopard was released, applications started storing their cache files as sqlite databases (usually named Cache.db). For example, Safari has its cache at:


Apps that haven’t caught up yet are still using the less-efficient .cache files. Though not as efficient, these files are easier to access, just toss it onto BBEdit and you can see the contents. Try doing this with a 100+MB .db file and prepare to wait.

There probably is a GUI app to extract data from .db cache files, but I’m too lazy for that. OS X has everything you need already built in so fire up (I’ve been playing with Visor lately) and dig into your cache:

# cd ~/Library/Caches/
# sqlite3 Cache.db

You’ll be in the sqlite interactive mode:

sqlite> select * from cfurl_cache_response;
sqlite> select receiver_data from cfurl_cache_blob_data where entry_ID = [1234];

To output the data to a file use the following:

sqlite> .output test.html
sqlite> select receiver_data from cfurl_cache_blob_data where entry_ID = [1234];
sqlite> .exit

That should do it. Any questions? Leave a comment.

Safari 4 Public Beta Annoyances

webkitFirst off, I’m going to start posting in a new format – a “squirt” (screw you zune). I have thoughts to convey that are too long for a tweet and too short for a full entry. I’ll put all these squirts into a single category.

Here are some things about Safari that are chapping my hide:

  • With the newest version of WebKit, it is actually slower in the SunSpider JavaScript benchmark. Before, I was running a custom build of Safari 4 with WebKit and was doing over 100 ms better.
  • It breaks if you are using the GrowlMail Bundle.
  • Nitro is the name of the new nebulous engine. How much of this is Squirrelfish and how much is optimization to WebKit?
  • 1Password doesn’t work. This is an InputManager so doesn’t really count as it’s an unsupported hack.
  • The blue loading bar is gone and the stop/reload within the URL bar is not intuitive. It’s also harder to see which pages are loading at a glance when clicking through tabs.
  • The bookmark button is cemented onto the URL bar. I don’t use bookmarks. Go away!
  • The trying-to-be-awesome-bar isn’t. It only matches the beginning of what you are typing. For example, in Firefox, I can type “alpha” and it will find the page I want. In Safari, I have to type “” before it finds it.
  • The search bar is jaring how it plops down like a ton of bricks. This animation is so not Apple.
  • I have a hunch Safari is renicing itself somehow. Opera is not nearly as responsive when Safari 4 is running. Is this just me?
  • Reboot to install a browser? Grrr.

Don’t get me wrong, there is plenty of nice eye candy, especially when you load up the browser for the first time. I’ve seen a lot of the “150 New Features” before as I’ve been compiling this version for a while now. Of those 150 features, there are probably 20 that are new and most I don’t really care about.

Anyway, WebKit has been and will continue to be my default browser (as I write this in Shiretoko).

image: apple Is Crashing Like Crazy

Mail.appUpdate: If the Envelope index trick doesn’t work for you, disable any bundles you have by moving them to the “Bundles (Disabled)” folder within ~/Library/Mail/. GrowlMail and Safari 4 Public Beta do not get along so you will have to disable this one.

I’m running two plugins (bundles) for – GrowlMail and WideMail – and have experience zero problems. Once in a while, I get in a frenzied state where it crashes if I breathe on it wrong. The console usually gives me nothing interesting, except maybe a message such as:

Mail[10935]: deleting invalid message from outbox

So I’m stuck with a flaky app. The usual cause of this is an inconsistent state in the mail index resulting from various things like trying to delete tens of thousand of server error messages from Gmail IMAP, or force quitting during a delete, or some other dumb act on my part.

To fix this, move “Envelope Index” from ~/Library/Mail/ and launch Mail. You’ll get an import dialog, hit “Continue” and wait. I have 322,984 messages to import so it will take a little more than a half an hour. Once done, you’ll usually see the corrupted message somewhere, usually in your spam or trash. Delete it (this step isn’t actually necessary for the fix).

Once you verify things are working, go ahead and delete the old “Envelope Index”, the import process created a new one for you.

image: Apple

What’s Taking Google So Long To Bring Chrome To OS X?

Google Chrome

Update: Mike Pinkerton, Mac Chrome developer, is writing some interesting tidbits on his blog.

Without being involved with Google or Chromium in any way, these are just stabs in the dark. I would love to hear from those in the know about what is going on.

As I see it, there are three fundamental reasons for the delay:

1) Priorities
Google knows the fastest way to gain market share is to bundle the browser at the OEM stage with the dominant operating system. To do this, they need a compelling case for why the browser should be bundled. This led to several things:

  • An extremely aggressive development cycle (I’m not on the dev channel, but know that they are pushing weekly builds).
  • One of the fastest Google products to pass through beta (OEM’s are somewhat reluctant to pre-load beta software).

This raises the advertising questions:

So can’t Google just use it’s advertising space to drive adoption?
Yes, but it generally doesn’t work. Chrome made a brief showing on the Google frontpage, breaking the rule of 28 but we know this doesn’t drive much traffic. Visitors to Google are usually looking to search for something, not download a new browser. Evidence of this can be see in ReadWriteWeb‘s analysis of the traffic the HTC G1 phone got from a Google link.

Also, you do see adsense ads for Chrome (instead of Firefox) popping up around IE or Firefox related articles. But I don’t think these are driving too much traffic.

2) Technology
I’m sure Chrome is packed chock full o’ technology that I don’t bring up here, but this should be a start:

With the preview release of Chrome 2.0, we saw Google dump WinHTTP in favor of its own codebase. This is great and all, but leads me to believe that the original codebase was developed in a quick and dirty style in 20% time with MS tools. More on this can be read in this thread where people have combed the codebase and saw how dirty it is.

This is another area where MS rears its ugly head. According to Nicolas Sylvain, Chrome developer:

The Mac and Linux version of Google Chrome are still in development. They are not ready yet.

We haven’t decided the implementation details of the sandbox on these platforms, but we clearly want something equivalent.

October 2, 2008 3:48 PM

This was in a comment made on this blog post titled “A new approach to browser security: the Google Chrome Sandbox“. It seems this is one of the main bottlenecks.

I thought V8 was the culprit for the longest time until I saw this article – “Building and compiling V8 on Mac OS X“.

3) Look and Feel
These is a third and rather weak argument for the delay. Back to the “Platforms and Priorities” post, Amanda Walker, Software Engineer tells us:

One overriding goal we have had from the start has been to build the best browser we can. When it comes to Mac and Linux versions, this means that our goal is not to just “port” a Windows application to these other platforms–rather, our goal is to deliver Chromium’s innovative, Google-style user interface without rough edges on any of them.

Yes, making Chrome feel native to the Mac is important, but does that take six months? I’m not buying it.

image: Google