What is SCID?

SCID is a free and open-source chess database tool. You can download it and find more information here. It is available for many platforms. I use it to manage my database of games and to analyze games after I am done playing.

For 99% of people, using the downloadable version is the right approach.

Building SCID on a Mac

I wanted to build my own copy of SCID because as I was connecting to my remote stockfish cluster, I noticed some inconsistencies. I wanted to be able to tweak the code a bit for my specific case to see if I could fix the problem. I also wanted to make sure I was using the latest version of the code.

You probably don’t want to do this.

If you really want do want to build your own copy of SCID, here is what I did to get it to work.

This is just a small tweak of the official instructions. There are few steps around installing XCode that I did not need to do as I already had that installed. Read more about that there if you are getting stuck.

Getting Organized and Downloading Files

My files were organized into folders like this, but there is nothing special about that. I just include it here for reference if you are wondering about some of the commands and paths I used below:

- ~/Dev/
  - Projects/
    - scid/
      - scid-code/
      - tcl8.6.11/
      - tk8.6.11/
  • Download latest 8.6 versions of Tcl and Tk here:
  • Extract them .tar.gz files into the directories above
  • Clone the SCID repo into the scid-code directory: https://git.code.sf.net/p/scid/code scid-code

Make TCL 8.6

Configure:

cd ~/Dev/Projects/scid/tcl8.6.11/macos
./configure --enable-framework --enable-aqua --enable-threads
sudo make
sudo make install

This is one place where I differed from the official instructions. I used the macos directory instead of the unix directory. I’m also not sure --enable-aqua works here. That might be the default and I think I got an error.

Optional Test:

/usr/local/bin/tclsh8.6 sudo make test

Finally, I’m not sure if this is needed or if it happened automatically:

sudo ln /usr/local/bin/tclsh /usr/local/bin/tclsh8.6

Make TK 8.6

This is very similar to the previous step of making TCL.

cd ~/Dev/Projects/scid/tk8.6.11/macos
./configure --with-tcl=/Users/matt/Dev/Projects/scid/tcl8.6.11/macos --prefix=/usr/local --enable-framework --enable-aqua
sudo make
sudo make install

After these two steps, you should be able to find the frameworks installed in /Library/Frameworks. The default 8.5.9 version that comes with a Mac is found in /System/Library/Frameworks.

Optional, but fun to watch test:

/usr/local/bin/tclsh8.6 sudo make test

It is fun to watch because windows keep popping up all over your computer. Don’t try to do anything while it is running other than watch because windows will pop up and steal focus.

Make SCID

cd ~/Dev/Projects/scid/scid-code/

Edit the tcl/start.tcl file:

----- FROM -----
package require Tcl 8.5
package require Tk  8.5
if {$tcl_version == 8.5} { catch {package require img::png} }

----- TO -----
package require Tcl 8.6
package require Tk  8.6
if {$tcl_version == 8.6} { catch {package require img::png} }

Edit the Makefile.conf file:

----- FROM -----
TCL_VERSION = @TCL_VERSION@

TCL_INCLUDE = @TCL_INCLUDE@
TCL_LIBRARY = @TCL_LIBRARY@

----- TO -----
TCL_VERSION = 8.6

TCL_INCLUDE = -I/Library/Frameworks/Tcl.framework/Headers -I/Library/Frameworks/Tk.framework/Headers
TCL_LIBRARY = -F/Library/Frameworks -framework Tcl -framework Tk

Build

./configure
sudo make clean install

Testing SCID

~/Dev/Projects/scid/scid-code/dist/Scid.app/Contents/Resources/bin/scid

If all goes well you should now have SCID running

Using SCID

Now, actually using SCID has turned into a bit of a pain.

First I tried this, which didn’t work. The app wouldn’t even start:

sudo cp ~/Dev/Projects/scid/scid-code/dist/Scid.app /Applications

Then I tried just copying the file through Finder. The app started, but couldn’t access my databases in ~/Documents. I am guessing this has to do with MacOS restricting permission to my ~/Documents directory.

In the end I just created an Automator task that runs the command in the Testing SCID section above. I’m not proud of this solution, but I was getting tired of this project and once I found something that worked I just left it.

Tcl 8.5.9 error

When I followed the official instructions, I got this error even though I tried to force it to 8.6:

scid-code ▷ dist/Scid.app/Contents/Resources/bin/scid
usage: dirname path
version conflict for package "Tcl": have 8.5.9, need 8.6
    while executing
"package require Tcl 8.6"
    (file "dist/Scid.app/Contents/Resources/bin/scid" line 36)

The main thing I changed to get around this error was building TCL and TK from the macos directory instead of the unix directory.

I also ran into this if I did not edit the Makefile.conf file. One time I edited the Makefile instead of Makefile.conf which gets overwritten.

Other information

I would like to try using homebrew to install TCL and TK frameworks, but I did not know that was available until after I had it working. If you want to try, you could do brew install tcl-tk and see what happens.