parse_git_branch() stopped working after Xcode 6.0.1 update [FIX]

I got a little surprise after I updated Xcode and the Command Line Tools this morning: the bash prompts in my shell had stopped displaying the current git branch. Eeek!

For those of you who aren’t familiar with parse_git_branch(), it’s a small bash script that simply highlights the current git branch at the end of the bash prompt. It lives in your ~/.bash_profile or ~/.bashrc file.

When it’s working, it looks something like this:

$ (master) (where (master) is the current git branch)

Some people use tools like zsh or liquidprompt to accomplish the same effect, but I use this little bash function because I don’t need all that extra stuff.

I poked around the web for a while this morning and couldn’t find any solutions.

Turns out, it’s a simple fix:

  1. Open Xcode
  2. Click to Agree to the new terms
  3. Install the remaining components
  4. Reload your shell of choice

Hope that helps somebody.

If you’re interested in using parse_git_branch() yourself, you can simply put the following into your ~/.bash_profile or ~/.bashrc file:

function parse_git_branch() {
	git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}

RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
NO_COLOUR="\[\033[0m\]"

PS1="$GREEN\u-MBA$NO_COLOUR:\w$YELLOW\$(parse_git_branch)$NO_COLOUR\$ "

There’s also a couple of non-sed versions floating around the web if that’s your preference. Adjust the colors as needed.

Started writing with Imagine

I’ve decided to try writing with Imagine.

On any given day I have a checklist to write, a couple paragraphs of help text to fine-tune or other little writing tasks. I’ve used TextEdit and MS Word but I don’t like the cluttered UI, nor do I need 100 options. To escape TextEdit, lately I’ve taken to using my code editor TextMate, which is ill-suited for simple text writing.

Right now, the pros for Imagine are simple:

  • It’s ready to write when I open it
  • It’s readable out of the box
  • It’s lightweight and free

We’ll see how it shakes out.

How to Make SiteLauncher Work With Firefox 5

Being a Web-worker, I rely on my browser to provide the tools I need to work quickly and efficiently. And since I’m an avid Firefox user, the last couple of months have been fraught with turmoil because I was torn between staying with the trends and updating Firefox (first from 3.6 to 4, then recently from 4 to 5) and waiting for the developers of all of my add-ons to keep up.

I waited and waited and waited to upgrade Firefox to version 5 because I was holding out for the developer of SiteLauncher, to be updated. SiteLauncher is integral to my workflow, because it allows me to open specific webpages using preset keyboard shortcuts.

Turns out, I didn’t need to wait.

Thanks to the folks over at The Heat Web, making SiteLauncher 2.1.0 compatible with Firefox 5 was as easy as changing a value in a file.

There are two ways to do this:

1) The Easy Way

» Download/install this (already modified) file sitelauncher2.1.0.xpi and restart Firefox

2) The Hard-er Way

» Visit the SiteLauncher Download Page, right-click the Add SiteLauncher to Firefox button and click Save As. Save sitelauncher2.1.0.xpi to your hard disk.

» Open the directory where you saved sitelauncher2.1.0.xpi and change the file extension to .zip (sitelauncher2.1.0.zip)

» Important: Open the .zip file in your archival software. DO NOT UNZIP THE DIRECTORY.

» Right click on install.rdf and open it in NotePad (or TextEdit on Mac)

» Locate the maxversion value and change it from 4.2alpre to something above 5. I changed mine to 5.9.9 to make it compatible all the way to Firefox 6.

» Save install.rdf and update the archive

» Back in the directory where you saved the original file, change the file extension back to .xpi from .zip

» All you have to do now, is drag the sitelauncher2.1.0.xpi file over to your Firefox window and it should prompt you to install the add-on.

» That’s it!

Update: Though this hack makes your SiteLauncher keyboard shortcuts work, you’re still unable to modify or add new shortcuts via the backend menus. Thanks Steven!