Imaginary-Entity
Imaginary-Entity

Reputation: 51

Setting core.editor for Git on Mac OSX

After setting Atom as my core editor for Git, when I then commit in Terminal I receive the error:

/usr/local/bin/atom -n -w: /usr/local/bin/atom: No such file or directory error: There was a problem with the editor '/usr/local/bin/atom -n -w'. Please supply the message using either -m or -F option.

From the error it seems that Atom.app isn't saved in the place that Git is looking. So I have type what I believe is the full path name:

git config --global core.editor " '/Applications/Atom' -n -w"

After this I still receive the exact same error message.

(I am new to Mac and Git, though I got all of this setup no problems on my Linux system)

Upvotes: 4

Views: 3904

Answers (1)

Ashutosh Jindal
Ashutosh Jindal

Reputation: 18869

I tried using Atom as the editor for commit messages and had no issues. The only thing I might have done differently is installing Atom using brew cask instead of manually downloading and installing:

  1. brew cask install atom (this installed v. 1.9.9 of atom)
  2. which atom to confirm that it is present in the path at /usr/local/bin/atom

enter image description here

  1. git config --global core.editor "/usr/local/bin/atom -n -w" to configure atom as the default git text editor.
  2. Tried a test commit which opens up atom to allow typing the commit message and waits for it to exit (thanks to the -w option above).

Looking at the atom in path, it is actually a symlink:

$ ls -l /usr/local/bin/atom
lrwxr-xr-x  1 az  admin  53  9 Oct 09:39 /usr/local/bin/atom -> /Applications/Atom.app/Contents/Resources/app/atom.sh

Therefore, I would recommend this:

git config --global core.editor "/Applications/Atom.app/Contents/Resources/app/atom.sh -n -w"

Upvotes: 6

Related Questions