Mercurial on Mac

Last updated by Adam West on August 29, 2019 10:42

This page will guide you through the process of getting Mercurial set up in your local terminal on your Mac machine and connecting to your repositories in Codebase. We support both SSH and HTTP connections but this guide will take you through how to connect via SSH.

Installing Mercurial

We recommend using Homebrew to get started. You can follow their guide to do so.

When you have homebrew ready, load your terminal, and enter the following:

$ brew install mercurial

You'll see some output, finished with:

==> mercurial
Bash completion has been installed to:
/usr/local/etc/bash_completion.dzsh completions have been installed to:

If you haven't already done so, you'll also need to generate an SSH key and upload it to Codebase which you can do by following this guide.

Setting up Mercurial

1. Edit `~/.hgrc` to include your name and e-mail address:

$ nano ~/.hgrc

2. Add the following into that file, modifying the username and email address appropriate (this should match your Codebase name and email address for commit to ticket linking to work correctly):

username = Adam West <>

Type `control+x`, followed by `y` and the `enter` key to save the changes.

Create and push a new repository 

1. Enter the directory which you wish to import to Codebase

$ cd path/to/local/folder

2. Initialise the folder as a Mercurial repository

$ hg init

3. Add all files and commit for the first time

$ hg add
$ hg commit -m "Initial commit"

4. Send commits to Codebase

$ hg push ssh://

That's it, you've now set up Mercurial locally and pushed to your first repository in Codebase.