Archive for Mac

Call TextMate from command line

A really neat feature of TextMate is the ability to call it from the command line and pass a directory or file as the object to open. Works great.

For this to work, you need to run a quick one-liner on the command line:

sudo ln -s /Applications/TextMate.app/Contents/Resources/mate /usr/local/bin/mate

Once done, you can call mate and pass it any object you want to open, such as:

$ mate my_rails_app

and it opens the entire directory as if it were a TextMate project.

Lots more detail available here: http://manual.macromates.com/en/using_textmate_from_terminal.html

Setting up Merb, Cucumber and Webrat (and friends) on Snow Leopard

My upgrade to Snow Leopard killed my Merb, Cucumber and Webrat setup so i had to start afresh. That was the bad. The good is that some manual hacks that were required in Leopard are no longer necessary, meaning I can rely on direct gem installations.

Here’s what i did:

  1. Install Ruby and Gems
    Follow instructions on http://hivelogic.com/articles/compiling-ruby-rubygems-and-rails-on-snow-leopard/
  2. Install merb, rspec, cucumber, merb_cucumber and mongrel and dependencies
    sudo gem install merb rspec cucumber roman-merb_cucumber mongrel term-ansicolor treetop diff-lcs nokogiri do_sqlite3
  3. Install webrat
    sudo gem install hoe hpricot webrat
  4. Fix Firefox bug with Snow Leopard
    For some reason the libsqlite3.dylib  library in FireFox 3.5.2 is out of date and breaks cucumber under Snow Leopard. Thankfully, it’s a simple fix:
    mv /Applications/Firefox.app/Contents/MacOS/libsqlite3.dylib /Applications/Firefox.app/Contents/MacOS/libsqlite3.dylib.orig
    cp /usr/lib/libsqlite3.dylib /Applications/Firefox.app/Contents/MacOS/libsqlite3.dylib
  5. Install Selenium
    sudo gem install Selenium
    sudo gem install selenium-client
  6. Install the textmate cucumber bundle
    http://github.com/bmabey/cucumber-tmbundle/tree/master

Deprecated Instructions on Snow Leopard that were required on Leopard

The following ugly hacks were required on Leopard with it’s default Ruby installation. These are no longer required (at least on my machine) on Snow Leopard:

Manual hack of Selenium

http://wiki.github.com/aslakhellesoy/cucumber/setting-up-selenium

As the instructions recommended replacing the Selemium RC jar file () in the installed gem with one from the Selenium website, i had to find out where the gem had installed. Thankfully, gem -h pointed me toward gem help commands and from there i ran gem environment – This told me where gems are installed locally and i found that Selemium RC had been installed into /Library/Ruby/Gems/1.8/gems/Selenium-1.1.14/ I replaced as advised and then ran selenium from within the app root and all worked fine, using the replacement. I then downloaded and ran the test selenium code from http://github.com/aslakhellesoy/cucumber/tree/master/examples/selenium running selenium in a different console and then running cucumber examples/selenium/features/ . It worked a treat and booted up selenium as required. Great!

Manual hack installation of webrat

Download http://github.com/gwynm/webrat/tree/master tar file. Git clone doesn’t work

sudo gem install hoe hpricot
cd downloaded and untarred file
rake gem
sudo gem install pkg/webrat-0.2.1.gem

How to open a Mac OS X sparsebundle when it shows up as a regular folder

This was taken from http://fplanque.com/dev/mac/os-x-sparsebundle-shows-up-as-regular-folder

What do you do if you have, say, an encrypted sparsebundle and some day you try to open it and you discover it shows up as a plain folder in the Finder instead as a bundle icon?

Double clicking will just open the folder and show you the bands that make up the bundle.

I’ve forgotten how to fix the issue,  you can at least mount the contents of the bundle by typing this is the terminal: "/path/to/bundle/name_of_bundle.sparsebundle/"

Then you’ll have your virtual drive mounted on teh desktop, and if need be you can just copy them to a new sparsebundle.

iPhone 3.0 beta 2 tethering how to

In iPhone 3.0 beta 1, tethering didn’t work. In beta 2, it does and it’s really simple to achieve. It does require a quick mod to your iPhone. Here’s what you have to do:

1. Download the o2_uk.ipcc carrier details file. Please note that this is the UK ipcc file. If you’re not on O2 in the UK, search google for your suitable ipcc file.
2. Connect iPhone to PC / Mac and select to restore with the option to select a custom restore package (hold down option on Mac before selecting restore)
3. Select the ipcc file as the restore package. The change of details on the phone takes only a few seconds and doesn’t require an iPhone reboot
4. Go into iPhone Settings app > General > Network > Internet Tethering and enable.
5. Connect iPhone to PC / Mac over USB or bluetooth
6. The PC / Mac will do the rest
7. Done!

Works great (i’m posting via tethering now)

Geeky note for reference: How to reset MacBook Pro PRAM

  1. Power down
  2. Press power on button
  3. Immediately press “alt + cmd + p + r”
  4. Await until 2nd chime
  5. Release keys
  6. Allow to boot as normal