sublime-text-git
sublime-text-git copied to clipboard
External difftool issue with this package
With my limited knowledge I've been trying to get this package to work with Kaleidoscope 2 for a few days. This is the error I get:
"/usr/local/git/libexec/git-core/git-mergetool--lib: line 119: ksdiff: command not found"
This is what Kaleidoscope injects into the ~/.gitconfig file:
[difftool "Kaleidoscope"] cmd = ksdiff --partial-changeset --relative-path "$MERGED" -- "$LOCAL" "$REMOTE" [diff] tool = Kaleidoscope [difftool] prompt = false [mergetool "Kaleidoscope"] cmd = ksdiff --merge --output "$MERGED" --base "$BASE" -- "$LOCAL" --snapshot "$REMOTE" --snapshot trustExitCode = true [mergetool] prompt = false [merge] tool = Kaleidoscope
Now if I change the cmd = ksdiff to cmd = path/to/ksdiff, this git package will fire correctly but then the cmd = path/to/ksdiff reverts back to cmd = ksdiff (I'm assuming Kaleidoscope is doing that). I've tried making some tweaks in the sublime packages but no dice.
Any suggestions?
This is an issue with ST2 not loading $PATH correctly.
I'm not familiar enough with ST2 to be sure why, but the default path from os.environ (which is what informs ST2s ability to find a given executable) is
/usr/bin:/bin:/usr/sbin:/sbin
so a simple fix (while probably not ideal) is to link /usr/local/bin/ksdiff to /usr/bin
sudo ln -s /usr/local/bin/ksdiff /usr/bin/ksdiff
After some research I figured out what the issue is:
pythons subprocess.popen called from inside an application on OS X as of 10.8 has it's environment set by
/etc/launchd.conf and in theory ~/.launchd.conf
In testing, ~/.launchd.conf didn't seem to effect the environment for subprocess.popen
To make the environment be able to find things in /usr/local/bin edit /etc/launchd.conf (you may need to create it and you'll need to be an admin do anything in /etc) to add
setenv PATH /bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin
Be very judicious about editing this PATH variable (and this file in general), you can cause yourself a lot of hassle if you put in a bad value.
After you've finished editing, restart your machine and git diff tool should work fine.
Any ideas on getting this to work on Windows?
Hi,
I have the same problem with Sublimerge.
/Library/Developer/CommandLineTools/usr/libexec/git-core/git-mergetool--lib: line 124: subl: command not found fatal: external diff died, stopping at <myfile>
Here is what I have in .gitconfig
:
[merge] tool = sublimerge
[mergetool] prompt = false
[mergetool "sublimerge"] cmd = subl -n --wait "$LOCAL" "$MERGED" "$REMOTE" "$BASE" --command "sublimerge_diff_views" trustExitCode = false
[diff] tool = sublimerge
[difftool] prompt = false
[difftool "sublimerge"] cmd = subl -n --wait "$LOCAL" "$REMOTE" --command "sublimerge_diff_views {\"left_read_only\": true, \"right_read_only\": false}"
The command subl
is in $HOME/bin
and links to ST3. I cannot create a symlink in /usr/bin
as it is now protected in OSX Sierra (by System Integrity Protection). I tried to create the /etc/launchd.conf
and set the PATH there but it did not have any effect even after restart.
The last thread was more than 3 years ago, maybe there changed something.
The problem was that Sublime itself did not see my $PATH.
Here is how to fix this issue: https://forum.sublimetext.com/t/how-to-set-path-on-os-x-so-sublime-can-see-it/11842