Sublime Forum

OSX command line "edit" doesn't launch sublime

#1

I followed the instructions here to set sublime as the default editor to launch from the command line.
sublimetext.com/docs/2/osx_command_line.html

However, when I run this:
$ edit /tmp/foo.txt

TextWrangler opens. It looks like my EDITOR environment variable is set right:
declare -x EDITOR=“subl -w”

Any ideas?

0 Likes

#2

Do

$ which edit

and see if you get something like

/usr/local/bin/edit

Then do

$ edit --version

and see if you get something like

    Edit tool version 2.0 (v86) Apr 30 2012
    TextWrangler application version 4.0.1 (3152)

    Copyright 2001-2012 Bare Bones Software, Inc.

Then do

$ man edit

and see if you get something like:

NAME
       edit - (TextWrangler) Whip some ASCII.

...

AUTHORS
        Bare Bones Software, Inc.
        Web site: http://www.barebones.com/
        Email: support@barebones.com

04/30/2012                                                 Bare Bones Software, Inc.                                                   EDIT(1)

If you got output something like I posted, ‘edit’ is a command line interface to TextWrangler.

0 Likes

#3

Thanks Phillip, you pegged it. I found the below online as an “uninstall” for the TextWrangler command line utils. After running, the edit command doesn’t work. I added the following as an alias in ~/.bash_profile, and that appears to do the trick.

Alias to fix (?) edit command:
alias edit=‘subl -w’

TextWrangler command line “uninstall” (produced some errors, but seemed to do the trick):
sudo pkgutil --unlink com.barebones.textwrangler.tools.textwranglerCommandlineTools.edit.pkg;
sudo pkgutil --forget com.barebones.textwrangler.tools.textwranglerCommandlineTools.edit.pkg;
sudo rm /usr/local/bin/edit;

sudo pkgutil --unlink com.barebones.textwrangler.tools.textwranglerCommandlineTools.edit-1.pkg;
sudo pkgutil --forget com.barebones.textwrangler.tools.textwranglerCommandlineTools.edit-1.pkg;
sudo rm /usr/local/share/man/man1/edit.1;

sudo pkgutil --unlink com.barebones.textwrangler.tools.textwranglerCommandlineTools.twdiff.pkg;
sudo pkgutil --forget com.barebones.textwrangler.tools.textwranglerCommandlineTools.twdiff.pkg;
sudo rm /usr/local/bin/twdiff;

sudo pkgutil --unlink com.barebones.textwrangler.tools.textwranglerCommandlineTools.twdiff-1.pkg;
sudo pkgutil --forget com.barebones.textwrangler.tools.textwranglerCommandlineTools.twdiff-1.pkg;
sudo rm /usr/local/share/man/man1/twdiff.1;

sudo pkgutil --unlink com.barebones.textwrangler.tools.textwranglerCommandlineTools.twfind.pkg;
sudo pkgutil --forget com.barebones.textwrangler.tools.textwranglerCommandlineTools.twfind.pkg;
sudo rm /usr/local/bin/twfind;

sudo pkgutil --unlink com.barebones.textwrangler.tools.textwranglerCommandlineTools.twfind-1.pkg;
sudo pkgutil --forget com.barebones.textwrangler.tools.textwranglerCommandlineTools.twfind-1.pkg;
sudo rm /usr/local/share/man/man1/twfind.1;

0 Likes