Setting up SGF file associations for KGS/CGoban3 on Mac OSX is a topic that comes up from time to time (previous discussions from
2009,
2008, and
2007).
I've come up with an alternative method to that same ends, which I'll be describing here. (The previously discussed methods didn't work for me.) This process has three parts. First we use "automator" and some bash scripting to create a mac-friendly wrapper to kgs that can launch arbitrary SGF files when they are dragged onto the application icon. Secondly, we use OSX native file associations to associate one specific SGF file with the wrapper so that double clicking that SGF will open it in KGS. Finally, we make the file association applicable to all SGF files on the system. These techniques work for me using OSX 10.6.6, your results may vary.
Part 1: An Automator wrapper for KGS
1.1) Launch "Automator" from your apps folder.
1.2) When asked to "Choose a template for your workflow", chose "Application"
1.3) Select the "Run Shell Script" action which is found under Actions->Library
1.4) Set the drop-down menu "Pass input:" to "as arguments"
1.5) Copy and paste the following script into the window:
Code:
if [ "${1}" == "" ]; then
/usr/bin/javaws ~/bin/cgoban.jnlp
else
/usr/bin/javaws ~/bin/cgoban.jnlp -nosplash -open $1
fi
in the script above, "~/" is a shortcut notation for "my home directory". You can see I keep my copy of cgoban.jnlp file in ~/bin/. You may need to adjust this path to point to where you keep your copy of cgoban.jnlp.
1.6) Chose "save as" from the file menu. I suggest you save the application in either /Applications, or in ~/Applications. Name the application whatever you like, I've chosen "auto_kgs".
Testing our progress so far: Open the finder to the folder where you've saved the wrapper application in step 1.6. You should see a new application with your chosen name. double-clicking this application should open KGS. Dragging any SGF file onto this application should open that SGF in KGS. If either of these tests fail, something has gone wrong.
Part 2: Setting up file associations for one specific SGF file
2.1) Double click (or control+click) any sgf file.
2.2) Chose "Open with ->" "Other".
2.3) Find your application created in step 1.6. Checkmark the box "Always open with". Finally, click open.
2.4) This specific sgf file should always open in KGS from now on.
Part 3: Expanding file associations for all SGF files
3.1) Double click (or control+click) on the specific sgf file from part 2.
3.2) Choose "Get Info" from the menu.
3.3) Expand the "Open with:" drop-down menu
3.4) Make sure your wrapper application from step 1.6 is listed in the "Open with:" drop-down menu.
3.5) Click on the "Change All..." button
3.6) Click on "Continue" when the pop-up pops up.
Well, with any luck, it's now working for you.
Edit History:
Sat March 26, added instructions for part three, revised previous steps slightly.