MacHg icon

About MacHg and using Mercurial from the Command Line

You can use the command line version of Mercurial (via the Terminal) interchangeably with MacHg. You can freely download and install whichever version of Mercurial you want on your machine and it will not conflict with MacHg since an independent copy of Mercurial is bundled inside the MacHg application. (In fact MacHg does this to ensure there are no conflicts or other problems with the users Mercurial configuration.)

To open a Terminal session from MacHg:

This will produce something like the following:

Terminal Screen

Note in the terminal session you can see the aliases mhg and chg are being set up. These aliases point to the version of Mercurial inside MacHg.

mhg

Using mhg you can call mercurial just like you would normally use hg if you had (or have) installed the Mercurial tool.

  1. mhg references the Mercurial binaries inside the MacHg application.
  2. It uses your normal ~/.hgrc configuration you have set up.

chg

Using chg you can call Mercurial in exactly the same way that MacHg calls Mercurial. That is chg is just like mhg except it passes the same configuration settings that MacHg uses.

  1. chg references the Mercurial binaries inside the MacHg application.
  2. It uses the same HGRC path as MacHg preferences are set to. This is ~/Library/Application Support/MacHg/hgrc and optionally it might also include ~/.hgrc
  3. chg sets the HGPLAIN environment variable.

Testing

One would mainly use chg in order to ensure that if you run into problems with MacHg you are then able to experiment with the commands in the same way MacHg would issue the command. Eg for testing of connectivity, its important to ensure that non-interactive login is taking place and thus its important to call Mercurial in the same way that MacHg will issue the command.

Permanent Alias

If you want you can simply copy the alias command from the terminal and put it in your ~/.bashrc or ~/.aliases file. This makes the alias always available. The Mercurial binary lives inside the MacHg application, but it is a full and independent version of Mercurial and MacHg does not need to be running for the terminal to execute the Mercurial commands.


Related Topics

Adding a Server Repository

About Security And Passwords

About MacHg Documents

External Links

Apple : The Terimal