Friday, December 10, 2010

Hate the emacs tilde backup files?

I do...but for decades I have been afraid to turn them off in case I ever needed the backup file, even though I have never used them once. Finally I snapped and tried to figure out how to turn them off. While looking this up, I came across a better option: store them all in a single hidden directory, instead of littering the whole filesystem with them. There is a nice package called "backup-dir" that even provides the ability to keep multiple versions of your backup files, while keeping them all out of sight and out of mind, and automatically cleaning up old versions. Learn more at:


To see how I pulled in the backup-dir package and set it up in my init.el file, see the change to my dotfiles project.



Wednesday, December 8, 2010

Creating/Deleting local and remote branches with git

In the course of my git-based workflow, more often than not, I use branches like this:

  • Create a new local branch starting from the HEAD of my current working branch.
  • Immediately push it upstream to the remote origin so that it exists in both places.
  • Set the local branch to track the remote branch.
  • Commit/push/repeat
  • Merge the branch back into master (or wherever it started from)
  • Delete the local branch.
  • Push to delete the remote branch.
Since this seems pretty common, and some of the commands to do this are a bit difficult to remember sometimes, I created two simple scripts called git-branch-create and git-branch-delete to help with this. Now my workflow looks like:

  • git branch-create feature_branch
  • Commit/push/repeat.
  • Merge branch back into parent branch.
  • git branch-delete feature_branch

To use these scripts via the above commands, download the scripts above and place them somewhere in your path. I even created short aliases for them like so:


Saturday, December 4, 2010

Installing curb gem on Mac OS X 10.6 (Snow Leopard)

If you have previously installed curl with something like:

    sudo port install curl +ssl

and then try to install the curb gem like:

    sudo gem install curb

and you find yourself getting an error that looks something like this:


In file included from /opt/local/include/curl/curl.h:44,
from curb.h:12,
from curb.c:8:
/opt/local/include/curl/curlrules.h:144: error: size of array ‘__curl_rule_01__’ is negative
/opt/local/include/curl/curlrules.h:154: error: size of array ‘__curl_rule_02__’ is negative
lipo: can't open input file: /var/folders/wX/wX64Cb+PGjG-EXuklO+I+k+++TI/-Tmp-//ccKIrqTY.out (No such file or directory)
make: *** [curb.o] Error 1

Then, I think I have a solution for you. Change your curb install command to this instead:

    sudo env ARCHFLAGS="-Os -arch x86_64 -fno-common" gem install curb

It seems a number of people on the web suggest re-installing curl as a universal binary using something like:

    sudo port install zlib +universal
sudo port upgrade --enforce-variants openssl +universal
sudo port install curl +universal

I do not like this approach. The original problem is that you installed an x86_64 version of curl (which is the default, as it should be) but you are trying to install a universal version of curb (which is unfortunately the default). Instead of re-installing curl to be universal, which is wasteful and takes forever, install curb using the x86_64 flags to build it. This is what you want, it works, and it only takes a few seconds.