2

Attempting to setup bash so I can call the "mate" command to edit text files. After running this line, the link appears to exist but I'm still getting "mate: command not found"

ln -s /Applications/TextMate.app/Contents/Resources/mate ~/bin/mate/mate
  • Textmate is installed in applications
  • using OSX Mountain Lion
  • directory structure is in place
1
  • Is it really ~/bin/mate/mate? I'd expect that to be ~/bin/mate
    – themel
    Oct 17, 2012 at 20:55

4 Answers 4

4

You need to install the shell support in textmate preferences. Follow these steps.

  • Open textmate
  • Open Preferences via your top menu TextMate > Preferences or pressing Command + ,
  • Click on Terminal tab
  • Click the install button

note: This will install the command line support to your bash file by default. If you are not using bash, you'll need to add the following line to your shell or select the correct path from the dropdown menu. Once you reload your terminal, this will load the path to the EDITOR variable.

export EDITOR="/usr/local/bin/mate -w"

make sure you reload your shell config by using source like this

source ~/.bashrc

check that your EDITOR variable has been loaded with this command

echo $EDITOR

Don't know what shell you are using? You can use the echo command to show the result of your $SHELL variable like this

echo $SHELL
1
  • had to do the explicit entry for export EDITOR="/usr/local/bin/mate -w" in ~/.bashrc; seems default path loading doesn't work anymore on some systems (mine was macOS 10.14.2). Nevertheless, nice piece!
    – Dut A.
    Jul 12, 2019 at 5:50
2

Try this:

alias mate='/Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate'

Put it in your ~/.bashrc file if you want to use it in every terminal session.

I have a feeling that the problem with your symlink solution is that ~/bin is in your PATH, but ~/bin/mate/ is not, so try alternatively:

ln -s /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate ~/bin/mate

Edit:

Removed the tilde before Applications, Applications is in the root not in the home directory.

7
  • not having any luck with those suggestions. It's been suggested that I add this: 'export EDITOR="mate -w" export PATH=~/bin:$PATH' to my .bashrc, but that's not workin either.
    – Brendan Biryla
    Oct 17, 2012 at 19:41
  • Did you source ~/.bashrc after adding in the new lines? Also, what is the actual path to launch Textmate from the command line in your environment? (i.e. where is the binary actually stored?)
    – sampson-chen
    Oct 17, 2012 at 19:49
  • Apologies, i'm a bit of a noob on this. I'm attempting part 2 of the bash course on peepcode.com and the instructor uses the "mate" command in his tutorials while setting up his environment so I'm attempting to set mine up so I can mimic his actions... I punched 'source ~/.bashrc' into the command line (and also refreshed the terminal window) and then attempted to use the mate command on the known location of a text file. Is that what you meant for me to do? Also, I think the binary location is here: /Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate
    – Brendan Biryla
    Oct 17, 2012 at 20:49
  • Try the updated answers. Also try to see if you can launch the application from commandline with: ~/Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate
    – sampson-chen
    Oct 17, 2012 at 20:53
  • ~/Applications/TextMate.app/Contents/SharedSupport/Support/bin/mate failed too, (No such file or directory) but The program works when i open it from dock or finder... strange
    – Brendan Biryla
    Oct 17, 2012 at 21:49
1

Just tried this and it worked fine for me on Mac OS X (Mountain Lion) and TextMate (1.5.11 r1635) installed in Applications.

It seems like you no longer need to create aliases/symbolic links to access the TextMate shell utility from command line. Instead, mate by default is installed in /usr/bin.

In Terminal, go to /usr/bin and list the files there. Do you see mate over there? If not, check /usr/local/bin.

If you didn't see mate in either of the folders above, try removing and installing again. I just tried a fresh installation and mate worked out of the box for me.

0

I don't know anything about OSX, but I think you should move that to ~/bin/mate instead of ~/bin/mate/mate. If the system put it there, use this:

ln -s ~/bin/mate/mate ~/bin/mate

else just move it:

mv ~/bin/mate/mate ~/bin/mate

You should also check your PATH. If you didn't already know, the PATH tells the system what executables to execute.

PATH="~/bin:$PATH"

You must log in to answer this question.