SSH Keychain Access in Mac OSX Sierra

Prior to Sierra keys were persisted between logins – and with an update to ssh Keychain is no longer used by default. It can get frustrating to be prompted to enter your passphrase for a key after an upgrade and after each restart.

In your ~/.ssh/config file you will need the following lines:

Host *
    UseKeychain yes
    AddKeysToAgent yes
    IdentityFile ~/.ssh/id_rsa

Change ~/.ssh/id_rsa to the filename of your private key and if you utilise multiple keys also add an IdentityFile line for each of them.

You also need to initially add the key to save the passphrase to Keychain for the first time using:

ssh-add -K ~/.ssh/id_rsa

SourceTree broke my SSH keys

Sourcetree is a great free git GUI client for Mac and Windows. A recent update (2.4) really broke my workflow however and it took me longer than it should have to figure out what the issue was.

It seems Atlassian are enforcing a behavioural naming convention for ssh keys, which seems somewhat crazy. Rather than go through and change all my own naming conventions to align with theirs I simply created some symlinks. Problem solved.

The format needed is: yourbitbucketusername-BitBucket.pub

Given the syntax for creating a symbolic link:

ln -s /path/to/original/ /path/to/link

You’ll need something along the lines of:

ln -s ~/.ssh/id_rsa.pub ~/.ssh/boolean-BitBucket.pub

Updating git in OSX

Recently there was a critical vulnerability in git announced affecting many git users including myself on OSX.

After downloading and installing the latest version of git and entering in Terminal

git −−version

I was presented with the incorrect version number. Checking where it had been installed with

which git

displayed the original

/usr/bin/git

instead of the newly installed version at

/usr/local/git/bin

To resolve this I added the correct path (to my bash profile)

export PATH=”/usr/local/git/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:$PATH”

and now which git correctly returned the new path and bumped the version

git version 2.0.1

Hide or show hidden files quickly in OSX

How to setup some quick shortcuts to toggle visibility of hidden files in Finder

  • In Terminal type: sudo nano ~/.bash_profile
  • Append to the file the following: alias showFiles=’defaults write com.apple.finder AppleShowAllFiles YES; killall Finder /System/Library/CoreServices/Finder.app’
  • In a new line type: alias hideFiles=’defaults write com.apple.finder AppleShowAllFiles NO; killall Finder /System/Library/CoreServices/Finder.app’
  • Save the file
  • To make the aliases available in Terminal type: source ~/.bash_profile

Now you have two additional commands: showFiles and hideFiles to make things easier.

Speeding up Firefox on OSX

Firefox had been running really slowly lately and as I am an awful hoarder of tabs closing the application took forever. I’d heard that since version 3 there was a sql lite table that according to Google could do with vacuuming – whatever that meant.

The SQLite database uses flat files for local storage and I wondered how big and bloated they had become over time. It turned out to be much worse than I expected. To view I typed the following into a command terminal

find ~/Library/Application\ Support/Firefox/Profiles -type f -name ‘*.sqlite’ -exec ls -arlth {} \;

My .places file was 40 megabytes which certainly wasn’t helping speed at all. The following command took care of the necessary housekeeping

find ~/Library/Application\ Support/Firefox/Profiles -type f -name ‘*.sqlite’ -exec sqlite3 {} VACUUM \;
find ~/Library/Application\ Support/Firefox/Profiles -type f -name ‘*.sqlite’ -exec sqlite3 {} REINDEX \;

OSX Lion 10.7.2 Tweetdeck Crashes

Twitter

Tweetdeck has been crashing on startup recently, – seemingly without any kind of pattern. At first I attributed this to OSX Lion related issues, but sometimes having Firefox or Chrome open seemed to solve the problem.

I have finally tracked down the underlying issue to Adobe Air, the framework powering Tweetdeck and many other applications. In fact it is the switching software for late model Macbook Pros toggling between the discrete and integrated graphics cards. Launching Firefox or Chrome forces the graphics card to switch to discrete mode, solving the autoswitching and crashing on startup error.

You can manually change the setting to solve the problem by navigating to System Preferences -> Energy Saver. Uncheck the Automatic Graphics Switching at the top of the preferences dialog.

A better fix however is to use gfxCardStatus which is a menu bar application for OSX that allows users of dual-GPU 15″ and 17″ MacBook Pros to view which GPU is in use at a glance, and switch between them on-demand.

Update 29/01/2012
I have discovered that VMWareFusion does not play nicely at all with gfxCardStatus. Fusion will work if you disable dynamic switching and force the use of the discrete GPU but if you change between the two, expect major issues. I’m disabling gfxCardStatus before launching Fusion to avoid the problems.

CSV to .plist conversion

Property list files (.pfiles) store serialized objects and are often used to store a user’s settings. They are also used to store information about bundles and applications in OSX and recently iOS.

Danilo Campos wrote some time ago some background information and provided his source and blogged about the subject. Better than that however, he provided an OSX binary to download if you want to get going straight away.

This little application makes it easy to format and process your source data in a familiar environment like Excel and then convert ready to use in your application.