Using Beyond Compare With Sourcetree For Mac

I used to use Diffmerge for my merge/comparison needs, however I find the outdated interface to be unfriendly and ugly to look at.

On Windows I use Sourcetree and Beyond Compare works without integration, it shows up in the appropriate dropdowns but on Mac it does not. I don’t understand why Sourcetree on Mac is different to Windows, but anyway.

Fortunately, Sourcetree makes it easy to use third party comparison tools even if they are not in the dropdowns.

Firstly, we need to install Beyond Compare “Command Line Tools” which allows us to call Beyond Compare.

Go into the Beyond Compare menu and choose Install Command Line Tools.

Secondly we need to configure Sourcetree to use the command line for Beyond Compare:

In Preferences and then the “Diff” tab, at the bottom there is a section which allows you to specify the compare tool.

Screen Shot 2015-11-02 at 8.55.43 PM

Visual Diff Tool: Other
Diff Command: /usr/local/bin/bcomp
Arguments: $LOCAL $REMOTE

Merge Tool: Other
Merge Command: /usr/local/bin/bcomp
Arguments: $LOCAL $REMOTE $BASE $MERGED

Copying Your Local SSH Public Key To A Remote Machine/Server In Mac OS

When it comes to working with your servers (or any remote machine for that matter), public key encryption is a must. The basics are: you register a public key on the server-side and then use your private key to authenticate with the remote machine.

So you’ve generated a new SSH keypair or you have your existing SSH keys in the form of id_rsa or whatever. Now you want to push them to your remote server so you can use your private key to login?

cat ~/.ssh/id_rsa.pub | ssh <user>@<hostname> 'cat >> .ssh/authorized_keys && echo "Public key successfully copied"'

You of course will want to replace <user> and <hostname> with their appropriate values and supply any other required values.

You should never copy and paste shell commands off of the internet, so lets quickly explain what the above code does. We actually are calling multiple commands one after the other, rather than one method that does everything for us.

  • cat ~/.ssh/id_rsa.pub — The concatenate command can do many things, but here we are simply concatenating the contents of our public key and then it is returned to the terminal window
  • | — We then pipe the returned contents of our public key file to an ssh call
  • ssh @ — This is where we connect to our remote machine where we want to save the key
  • cat >> .ssh/authorized_keys — Assuming everything went okay, we then use cat command to store the piped contents of our public key into the authorized_keys file