Installing ksdiff
in Kaleidoscope > Integration… requires entering an admin password.
If you need a little refresher on what ksdiff is and why you may want to use it, see various articles we have on the topic.
Some users do not have admin privileges on their machine, but sill want to use ksdiff. Here are a few ways to make it work. Pick depending on your proficiency and preference. This articles assumes you have Kaleidoscope installed and licensed (or you are running a free trial).
Use ksdiff in its original location
ksdiff is a command-line tool that is part of the Kaleidoscope app. Assuming you keep Kaleidoscope in the default Applications folder, its path is /Applications/Kaleidoscope.app/Contents/MacOS/ksdiff.
You can always just type that full path when you want to use ksdiff. So instead of just typing:
ksdiff file1.txt file2.txt
you need to type:
/Applications/Kaleidoscope.app/Contents/MacOS/ksdiff file1.txt file2.txt
If this does not sound convenient enough, read on.
Installing ksdiff
All that the ksdiff installation does is to create a link in /usr/local/bin/ksdiff
to the original location of ksdiff in your Kaleidoscope app. /usr/local/bin is the Apple sanctioned location for installing tools that are in your default PATH
. The PATH is important as it allows you to just type ksdiff instead of remembering and typing the full path to wherever the ksdiff executable is actually stored each time. Access to /usr/local/bin directory is only permitted with admin rights, which is the reason Kaleidoscope has to show the authorization prompt.
Add ksdiff to your path
As hinted above, the difference between typing in just ksdiff and the full path to ksdiff is that this full path needs to be in an environment variable called PATH
in your shell. Don’t be afraid if you didn’t get all the details of the last sentence. A shell is what interprets the things you type into your Terminal app. By default, the shell is called zsh
on modern Macs.
If you are using a different shell or have otherwise customized command-line related settings on your Mac, we assume you know how to add a custom path. Please don’t follow the instructions below in that case. Others read on.
When this zsh shell starts, it reads a file called .zshrc
. Whatever we do in that file, will be available all the time. We are going to add our new PATH
setting there.
For the following step-by-step instructions, please ensure to type every letter as outlined. Terminal input needs to be absolutely precise to work, missing a space, a dot or a dash can make a huge difference.
- In Finder, locate Terminal in /Applications/Utilities and double-click the icon to start the app
- You should see a new Terminal window
- As a test, type which ksdiff into that window, followed by the enter key
- You should get
ksdiff not found
as a result - Type touch .zshrc followed by enter. Make sure to include the period at the beginning.
- Type open -a TextEdit .zshrc followed by enter
- Now the TextEdit app opens with a file. If you have a default installation, that file will be empty, so you see an empty window. If not, please check if there already is a
PATH
setting and amend that instead, using the information below, if you feel confident doing that. - Add the following line to that file:
export PATH=/Applications/Kaleidoscope.app/Contents/MacOS:$PATH
- Type enter
- Select File > Save from the menu, or hit ⌘S
- Close the window
- Quit TextEdit
- Important: Open a new window in Terminal, either via ⌘N or menu Shell > New Window > New Window with Profile – Basic
- A new Terminal window appears
- Repeat the test from above, type which ksdiff followed by enter into that new window
- The output now should be
/Applications/Kaleidoscope.app/Contents/MacOS/ksdiff
- You can now quit Terminal
- You are now ready to use ksdiff from anywhere on your user account