How do I get git to use Textmate as my default editor?

At the command-line, if I do mate <filepath> it opens up the right file for me in TextMate.

But when I do:

  • How do I modify cygwin's PS1 for git bash completion?
  • How do I exit my git commit message? I'm NOT in the VIM, I used the “ commit -m ” command
  • How do I get the SHA of HEAD in a specific git submodule?
  • Git hook to update various web folders based on branch pushed to remote server
  • Git post receive hook with sudo -u not working for some users
  • How can a shell script get input from an external editor (like Git does)?
  • $ mate -v
    open: invalid option -- v
    Usage: open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b <bundle identifier>] [-a <application>] [filenames] [--args arguments]

    Also, when I do git commit, I see this:

    $ git commit
    error: cannot run mate: No such file or directory
    error: There was a problem with the editor 'mate'.
    Please supply the message using either -m or -F option.

    My ~/.bashprofile has these lines:

    #Set Textmate as my default editor from the command-line
    alias mate='open -a'
    export EDITOR="/usr/local/bin/mate -w"

    And ~/.bashrc has just this one:

    alias mate='open -a'

    Edit 1

    My ~/.gitconfig includes the following:

        name = My Name
        email =
        editor = mate
        user = marcamillion
        token = 50e3iuaidsgadjkhwkjegakjhbsdkjb30432 (don't worry, this is fake)


  • How to reset rebase squash?
  • Jenkins git plugin: Peer's Certificate issuer is not recognized
  • initial commit failed android studio. cannot read
  • Sync Git repository with the Git Integrated in VSTS
  • git download, not clone fetch etc
  • “git push” failed: “You did not specify any refspecs to push”
  • 2 Solutions collect form web for “How do I get git to use Textmate as my default editor?”

    By adding the following to the core section in ~/.gitconfig

        editor = mate

    Ok if it’s already there then the issue is probably with textmate and not git.

    Textmate 2:

    In preferences there is a terminal tab and an install button
    When you click on install mate will be in /usr/local/bin/mate and everything should work.

    Textmate 1:

    You need to create a symbolic link

    I have textmate 1 (I use vim now 🙂

    ls -l `which mate`
    lrwxr-xr-x  1 jameskyburz  staff  66 Jul  1  2011 /usr/local/bin/mate -> /Applications/

    ln -s /Applications/ /usr/local/bin/mate

    The editor used to edit the commit log message will be chosen from the
    GIT_EDITOR environment variable, the core.editor configuration
    variable, the VISUAL environment variable, or the EDITOR environment
    variable (in that order).

    Easy way to configure this, assuming the mate path is correct, is to run

    git config --global core.editor "/usr/local/bin/mate -w"

    Assuming, of course, that you can run /usr/local/bin/mate -w. Check that by running /usr/local/bin/mate -w with your local user. If it isn’t found, you can use which mate to find it if it exists in your path at all – if it doesn’t, I’d think you need to use the form you have in your alias (open -a -w).

    Edit: incorporated comments into the answer.

    Git Baby is a git and github fan, let's start git clone.