Search code examples
macosterminaloh-my-zshlaunch-services

Modify the `edit` binary in os x to a different editor


On the command line, I can type edit <folder/file name> and it will open in TextWrangler, which I haven't used in ages. I'm not sure how the edit binary got there — I use oh-my-zsh, potentially relevant. I wanted to change subl to edit (nicer to type) and discovered it already existed.

I uninstalled TextWrangler and now I get the error

edit: error: -10814
    LaunchServices could not locate your copy of TextWrangler.

I've been looking around for how to modify the LaunchServices database and I've rebuilt it but I still get the error. Running which edit gives me /usr/local/bin/edit fwiw.

What controls this association and how can I switch it to Sublime Text?


Solution

  • If you were to run ls -al /usr/local/bin/edit you'd see this:

    lrwxr-xr-x  1 root  wheel  52 Apr 15  2012 /usr/local/bin/edit -> /Applications/TextWrangler.app/Contents/Helpers/edit
    

    Therefore, it looks like edit is a built-in command-line program for TextWrangler, just like subl is for Sublime, or mate is for TextMate. Of course, there's nothing stopping you from deleting the symlink, then making a new one pointing to subl if you want to.