127

I've installed git on a mac via brew install git. When I try to start gitk I get the following error:

Error in startup script: unknown color name "lime"
    (processing "-fore" option)
    invoked from within
"$ctext tag conf m2 -fore [lindex $mergecolors 2]"
    (procedure "makewindow" line 347)
    invoked from within
"makewindow"
    (file "/usr/local/bin/gitk" line 12434)

It appears that my Mac doesn't have a color named lime.

Can I add a lime color to the environment, or is there a better fix?

The git version is 2.7.0, and the Mac is running Yosemite 10.10.5

ReggieB
  • 8,100
  • 3
  • 38
  • 46

10 Answers10

198

You can check your version of Tcl/Tk by running wish and using the command info patchlevel. It appears that git 2.7.0, Tcl/Tk 8.5.9, and OS X 10.11 El Capitan do not work well together.

I solved this problem by doing brew cask install tcl, which installed 8.6.4, and gitk works now.

Kate Bertelsen
  • 3,900
  • 5
  • 24
  • 18
  • 3
    There's something odd using MacPorts here. Tcl version 8.6.4 is installed, but wish is reporting 8.5.9. – edA-qa mort-ora-y Feb 01 '16 at 08:23
  • 4
    Once I installed a new Tcl/Tk, I had to do `brew install --build-from-source git` in order to get `git gui` to start `gitk` with the updated Tcl. – lo5an Feb 04 '16 at 01:27
  • 1
    A caveat I've since discovered: if you have tcl 8.6.4 installed, then `rbenv` has trouble installing new Ruby versions. – Kate Bertelsen Feb 18 '16 at 15:33
  • `brew cask install tcl` is currently giving me a Ruby error `undefined method 'default_spec_cache_dir' for Gem:Module` :/ Fortunately, Konrad's answer below works in the meantime. – Cory Klein Feb 29 '16 at 22:57
  • Doesn't work for me (on El Capitan): "brew cask install tcl" installs 8.5.9, not 8.6.4, so the error remains. Konrad's workaround fixed the problem until this can maybe work. – FGM Mar 02 '16 at 09:01
  • Make sure you `brew update` to make sure you have the latest version information. Beyond that, I don't know why I'd get 8.6.4 and someone else would get a different version. – Kate Bertelsen Mar 02 '16 at 16:35
  • didn't work for me. El Capitan 10.11.4. Replacing "lime" as suggested in following answer by Konrad worked. – Assaf Shomer Apr 21 '16 at 07:00
  • My gitk also didn't work from gui, so I followed the tip from @lo5an, but first I had to `brew uninstall git` – jotaEsse Apr 29 '16 at 11:51
  • 3
    I installed Tcl 8.6 without brew, by downloading the [ActiveTcl installer package](http://www.activestate.com/activetcl/downloads). Gitk works fine now. – Pasi Välkkynen May 23 '16 at 06:09
  • i installed tcl 8.6.4.1 successfully with brew cask but `info patchlevel` still shows `8.5.9` after install. what am I missing? – Renaud Jun 09 '16 at 11:11
  • Well here is the answer to my previous comment: http://stackoverflow.com/questions/21129498/idle-warns-against-an-old-tcl-version-even-though-ive-installed-a-newer-version – Renaud Jun 09 '16 at 11:23
  • actually `tclsh` now gives `8.6.4` but `wish` still gives `8.5.9` and I still get the lime error when trying to run `gitk` – Renaud Jun 09 '16 at 15:02
  • 1
    If I try to run `brew cask install tcl` within the wish command line I get the following error: invalid command name "brew" – mrbela Jul 05 '16 at 20:03
  • @mrbela: Did you get the solution – Sagar Trehan Nov 08 '16 at 09:48
  • @SagarTrehan no, sorry. – mrbela Nov 15 '16 at 09:34
  • @edA-qamort-ora-y The updated tcl is probably installed under `/usr/local/bin`, whereas the previous tcl binary is under `/usr/bin`. You can verify this by running `$ whereis wish`. The workaround for is to prioritize `/usr/local/bin` in my `bashrc` by setting `export PATH=/usr/local/bin:$PATH`. After this, `gitk` works. – kc2uno Dec 12 '16 at 07:00
  • I got "Warning: A Cask for tcl is already installed." and even after reinstalling tcl, gitk still not working: "brew cask reinstall tcl" – Malik Shahzad Jan 04 '17 at 14:19
  • @Malik you need to install homebrew – n_b Jul 19 '17 at 21:10
49

I also found the same problem with exactly the same version of git and OSX. As a temporary workaround I suggest you to do the following:

cp /usr/local/bin/gitk /usr/local/bin/gitk.bkp
vi /usr/local/bin/gitk

and replace all occurences of lime to any color you want (I used #99FF00). Here is the vim command:

:%s/lime/"#99FF00"/g

EDIT: Please follow Keith B answer for permanent fix.

Konrad
  • 1,605
  • 3
  • 24
  • 45
9

@Konrad Thanks for the help!! Although the answer is correct, please be aware that your command

:%s/lime/"#99FF00”/g

contains two different quotation marks, which will def. throw an error if copied & pasted.

So in order to go through with it, I had to do:

cp /usr/local/bin/gitk /usr/local/bin/gitk.bkp
vi /usr/local/bin/gitk

And inside vim:

:%s/lime/"#99FF00"/g
Lukars
  • 141
  • 5
4

If you don't want to use Caskroom, follow this:

$ brew install tcl-tk
$ brew link tcl-tk --force
merito
  • 465
  • 4
  • 15
4

I was face same issue in ubuntu system. Then i flow below step to resolve issue.

  1. open /usr/bin/gitk file in any text editor

  2. search 'lime' keyword in file

  3. replace 'lime' to 'green' with all in file

  4. save file changes

  5. try again gitk then it works

kaushal sharma
  • 231
  • 2
  • 7
2

Useful addition to the good answers suggesting replacing all occurrences of the word "lime" by the word "green" in the file /usr/bin/gitk or /usr/local/git/bin/gitk:

The replacement of occurrences of "lime" in the above "gitk" file is sometimes not enough.

You also need to do the same replacement process on the file ~/.config/git/gitk, or remove that file.

sdive
  • 2,047
  • 1
  • 20
  • 20
2

I am running MAC with Yosemetti and followed the below steps to resolve.

open /usr/local/git/bin/gitk file in any text editor

search 'lime' keyword in file

replace 'lime' to 'green' with all in file

save file changes

try again gitk then it works

Thanks @kaushal sharma, followed your answer, with a change in the gitk path.

Venu
  • 1,513
  • 3
  • 19
  • 37
0

Follow the instructions above, but additionally do the following:

before running vi: chmod +w /usr/local/bin/gitk

after closing vi: chmod -w /usr/local/bin/gitk

riscv
  • 1
  • 1
  • Please note that "above" has no context in answers, since they can be sorted in various ways. It would be better to link directly to the answer to which you are referring. – ale Jan 15 '16 at 16:25
0

Make sure, your path is set correctly when trying Keith B's solution. Running brew doctor showed, that I had /usr/bin before /usr/local/bin.

~ $ brew doctor
...
Consider setting your PATH so that /usr/local/bin
occurs before /usr/bin. Here is a one-liner:
  echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
0

Thanks Konrad ,It work for me with below step

  1. sudo brew update
  2. sudo brew cask install tcl

-

user1665785
  • 11
  • 1
  • 2