Get “hg view” to work in Mac OS X
I finally wanted to make hg view work.
When I downloaded a Mac OS X installer for Mercurial I noticed that the hgk extension (invoked by hg view) didn't work out of the box. No big deal right away.
Today I wanted to use it though!
Here's how to get it to work:
Download and install a new version of Mercurial using the link above.
Clone the Mercurial repository, then update it to the revision that you had just installed, and finally copy the hgk script to your personal bin directory:
$ hg clone http://selenic.com/hg hg-upstream $ hg up -r b7f44f01a632 $ cp hg-upstream/contrib/hgk ~/bin
You could also copy it to your system-wide bin directory:
$ sudo cp hg-upstream/contrib/hgk /usr/local/bin
Edit your ~/.hgrc file to turn on the extension and point it to the location of your hgk script:
[extensions] hgk= [hgk] path=/Users/myusername/bin/hgk
(If you copied it to your system-wide bin directory, use /usr/local/bin/hgk for the path value.)
February 7th, 2008 at 1:29 am
When i installed Mercurial to my MacBook with Leo, i reviece error:
2.5.1 (r251:54863, Oct 5 2007, 21:08:09)
[GCC 4.0.1 (Apple Inc. build 5465)]
Traceback (most recent call last):
File “”, line 1, in
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py”,
line 441, in getdefaultlocale
return _parse_localename(localename)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py”, line 373, in _parse_localename
raise ValueError, ‘unknown locale: %s’ % localename
ValueError: unknown locale: UTF-8
Solution:
Add 2 lines to ~/.profile
export LC_ALL=en_EN.UTF-8
export LANG=en_EN.UTF-8
February 7th, 2008 at 8:43 am
@igorekk:
Thanks for the comment and solution! Thankfully, it worked out of the box for me but I’m sure others will appreciate your help.
When I inspect LANG I get “en_US.UTF-8″ but LC_ALL is unset on my system. I can’t find right off hand where it’s being set though :) Not in any of my dot files and not in anything at the top level of /etc.
March 8th, 2008 at 12:25 pm
Thanks for this post. Worked nicely for me.
Just getting my head around Mercurial. I’ve been using Subversion for a while so it is a bit of a mindshift. Lack of a GUI is a serious issue for me.
March 16th, 2008 at 2:17 pm
Thanks, it’s working great!
April 26th, 2008 at 6:10 am
Thanks for that walkthrough, was really useful!
May 13th, 2008 at 11:10 pm
@igorekk : thanks for the fix, I could have wasted quite some time figuring that out !
June 17th, 2008 at 1:09 am
I’m receiving a similar error:
Traceback (most recent call last):
File “/usr/local/bin/hg”, line 18, in
mercurial.util.set_binary(fp)
File “/Library/Python/2.5/site-packages/mercurial/demandimport.py”, line 74, in __getattribute__
self._load()
File “/Library/Python/2.5/site-packages/mercurial/demandimport.py”, line 46, in _load
mod = _origimport(head, globals, locals)
File “/Library/Python/2.5/site-packages/mercurial/util.py”, line 33, in
_encoding = locale.getlocale()[1]
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py”, line 460, in getlocale
return _parse_localename(localename)
File “/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/locale.py”, line 373, in _parse_localename
raise ValueError, ‘unknown locale: %s’ % localename
ValueError: unknown locale: UTF-8
I’ve tried adding the following 2 lines to ~/.profile
export LC_ALL=en_EN.UTF-8
export LANG=en_EN.UTF-8
but this hasn’t helped. Can anyone offer any tips or suggestions?
June 17th, 2008 at 9:08 am
I found my answer here:
http://henrik.nyh.se/2007/10/displaying-utf-8-correctly-in-leopard-terminal