10

I am very new to Mac, coming from Linux.

I am using TextMate, and I suddenly discovered I do not know how to launch TextMate from command line. Using completion, nothing looks like TextMate. Where is it located from a command line perspective?

Sorry for this odd question that also applies to other software, I guess.

4 Answers 4

16

For Textmate there is a command line tool, mate, that can be installed. Once installed you just use mate <file> to open that file in text mate.

For application that don't have a command line tool, you can use the open command with the -a flag and the name of the application. i.e.

open -a iTunes

This also works for TextMate:

open -a "TextMate 2"

The executable file is located in the app's Contents/MacOS subfolder, so for TextMate 2, it would be:

/Applications/TextMate\ 2.app/Contents/MacOS/TextMate

But if you run it from the command line like that, it will hang the shell until the application is quit (on certain older OSs; this was resolved as of 10.8) If this happens to you, put an & at the end of the command to background the process. Such as:

/Applications/TextMate\ 2.app/Contents/MacOS/TextMate &

The problem with this is that if the shell exits (by quitting Terminal or closing the window) then TextMate is terminated without warning.

2
  • 1
    Is there a possibility to create an alias to open -a iTunes to just type iTunes?
    – fsimkovic
    Commented Jan 7, 2014 at 21:55
  • 3
    yes, in your .bashrc, type alias iTunes="open -a iTunes". Then exit out of the file, and then type source ~/.bashrc Commented Jan 7, 2014 at 22:02
1

I guess they've made this easier recently. You can now install the "mate" command by going to...

TextMate "Settings..." -> "Terminal" -> Click the "Install" button

(where it's now saying "uninstall" for me). You'll need to authorise the change with your admin password.

TextMate settings terminal mate install

0

I have made this apps for myself. Hope it helps you
https://github.com/cnstntn-kndrtv/open-in-buttons-for-finder-toolbar

1
  • 1
    Welcome to Ask Different! We're trying to find the best answers and those answers will provide info as to why they're the best. Answers should be self-contained so explain why you think the answer you provided will solve the problem or is better than others out there. Providing links as supporting information can also help the OP, and others, find additional info for themselves. See How to Answer on how to provide a quality answer. - From Review
    – fsb
    Commented Mar 28, 2017 at 16:57
0

Open file with TextMate from terminal:

open -a TextMate path_to_file

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .