Secret in Twitter for Mac

For the some of you who don't know what Twitter for Mac secret menu is. Back to the age before Tweetie was acquired by Twitter I was one of the MacHeist bundle-buyers. Needless to say we didn't get what we waited for, instead of Tweetie 2 we saw the official Twitter for Mac client debuted on App Store for free.

Story behind

Here comes the best part. MacHeist didn't let us down, though. We received an email from MacHeist to be infoed that Twitter for Mac has some kind secret easter egg, which are only available to bundle buyers or whoever is reading this article. The image shows below is the Secret menu I unlocked from the latest version of Twitter for Mac 2.1.1, just to show you the method I provided is still working.

Secret Menu
Twitter for Mac's Secret Menu

As you can see the Secret menu gives you a lot more option to use this client. My favourite parts are "Type anywhere", "Show full names", and change "Quote Syntax" to RT @{USERNAME}: {TEXT}.

Hacking

There're a lot methods online need you to use several different Termianl commands to trigger these secret option. But my way is to fully unlock this menu in Twitter for Mac's Preference menu.

  1. Quit Twitter for Mac
  2. Open Terminal, which is located in your /Applications/Utilites/ folder
  3. Copy and paste these two commands in Terminal individually
  4. Note: The string value I put after reg.email3 is my personal email address. For reg.license3 what I used is the Serial number I got when I purchased the Bundle. If you were one of the bundle-buyers you can use your own email address and serial number as well!
    defaults write com.twitter.twitter-mac reg.email3 -string "mckaywei@gmail.com"
    defaults write com.twitter.twitter-mac reg.license3 -string "macheist-pants-snort-cake-29102699"
  5. Open Twitter for Mac, press ctrl + opt + cmd ( Same keys used to use to trigger the Secret menu in Tweetie 2 )

That's it, check your Preference menu you should be able to see the Secret menu now.

Happy hacking! Enjoy >_

Wonder how?

Let's explore a little bit more of how defaults write tweaks on OS X.

Hopefully you've seen and used defaults commands before. What it does is allowing user to read, write, and delete OS X user preferences from a command-line shell (e.g /bash and /zsh). The defaults command is followed by ( read, write, delete ) + domain + key + value. Which is also the structure I used in those two commands.

DOMAIN It's not hard to find domain ( not the domain name we type in the browser address bar ). Dig deep via:

/Applications/Twitter.app/Contents/info.plist

I find this:

<dict>
<key>CFBundleTypeRole</key>
<string>Editor</string>
<key>CFBundleURLName</key>
<string>com.twitter.twitter-mac</string>
<key>CFBundleURLSchemes</key>
<array>
<string>twitter</string>
</array>
</dict>

Note: It'd be a lot easier to find if you open it in Xcode.

KEY The hardest part to figure it out if you don't have any App Dev background. Me neither tho. In the past, locating these hidden preferences involved going through binary code of the application and searching for readable string, and then guessing how they might work. The old fashion is no longer work for us after Mac OS X 10.6 came out. Then we turn to GNU debugger, we use it to debug the application's running processes and find out what strings it uses. So the next thing I did is quitting the Twitter for Mac and opening my Terminal starts gdb this path:

/Applications/Twitter.app/Contents/MacOS/Twitter

Then relaunch Twitter for Mac, it launches slower the usual after I run the command.

Now I can chill a little, make myself a coffee and wait. Click around in the Twitter for Mac Preferences menu, checks all the preference settings in that GUI. Let the app run for a while and then quit Twitter for Mac. The results shows me a long list of preferences and domains. I put the results in a text editor and try to search key word email. Below is the preferences and domains it's followed by contains email and license:

reg.email3;kCFPreferencesCurrentApplication
reg.license3;kCFPreferencesCurrentApplication

The results before the semicolon are the keys I need, after are the domains. But I guess for some reason the domain doesn't always look like com.twitter.twitter-mac. I'm not an App developer so I don't know why, but I do know kCFPreferencesCurrentApplication indicates a preference that applies only to the current application, and kCFPreferencesAnyApplication indicates a preference that applies to any application after I checked Mac Developer Library.

VALUE The value didn't come free, but since it has no other use I don't might to share.

Tweetie Receipt
My Tweetie receipt

My email address is the string value for the key reg.email3; and the serial number is the string value for reg.license3.

Job done!

つづく

I didn't go too further about how to use GDB to find hidden preferences in any applications. I would probably write about more details in the next post. Stay tuned!