1

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?

lucasarruda
  • 1,462
  • 1
  • 25
  • 45
mhkeller
  • 713
  • 1
  • 8
  • 19

2 Answers2

2

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.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
0

To switch, you can run the following commands:

rm /usr/local/bin/edit
ln -s /Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl /usr/local/bin/edit

In my case, I had replaced TextWrangler for BBEdit, so I just did those commands but with /Applications/BBEdit.app/Contents/Helpers/bbedit_tool instead of the Sublime (subl) one.

lucasarruda
  • 1,462
  • 1
  • 25
  • 45