= Installing on Mac OS X =
There are several ways to install TortoiseHg on Mac OS X.
<>
DMG packages are also available, look for the most recent *-mac-x64.zip at our [[https://bitbucket.org/tortoisehg/files/downloads|downloads]] page
----
== Install from Source ==
=== Dependencies: PyQt and QScintilla ===
==== 0. Install Apple Development Tools (Xcode) ====
http://developer.apple.com/technologies/tools/
==== 1. Install Qt4 (Qt SDK for Mac) ====
http://qt.nokia.com/downloads
Direct access via
http://qt.nokia.com/downloads/qt-for-open-source-cpp-development-on-mac-os-x/
For Snow Leopard (10.6) users: python2.6 is now run on 64-bit environment by default. Please install 64-bit Qt binary, "Cocoa: Mac binary package for Mac OS X 10.5 - 10.6 (32-bit and 64-bit)".
Do not install Qt version 4.7.1 or 4.7.2. These versions generate crashes in some cases.
Note: Qt 4.7.0 does not crash but you will not be able to use keyboard shortcuts corresponding to contextual menu items. This version could be found on [[ftp://ftp.qt.nokia.com/qt/source/qt-mac-opensource-4.7.0.dmg]] with all other versions.
==== 2. Install QScintilla (from source) ====
http://www.riverbankcomputing.co.uk/software/qscintilla/download
{{{
~/Downloads/QScintilla-gpl-2.4.3
$ cd Qt4
$ qmake -spec macx-g++
$ make
$ sudo make install
}}}
installed files:
* /usr/include/Qsci
* /Developer/Applications/Qt/translations/qscintilla_*
* /usr/local/Qt4.6/qsci
* /Library/Frameworks/libqscintilla*
(Optionally) install Qt Designer plugin:
{{{
~/Downloads/QScintilla-gpl-2.4.3
$ cd designer-Qt4
$ qmake -spec macx-g++
$ make
$ sudo make install
}}}
installed files:
* /Developer/Applications/Qt/plugins/designer/libqscintillaplugin.dylib
==== 3. Install Sip (from source) ====
http://www.riverbankcomputing.co.uk/software/sip/download
{{{
~/Downloads/sip-4.10.2
$ python configure.py
$ make
$ sudo make install
}}}
For Snow Leopard (10.6) users: If you installed 32-bit Qt, append {{{-n --arch i386}}} to {{{configure.py}}}. See http://old.nabble.com/PyQt4,-Qt-on-osx-SnowLeopard-td26394590.html
installed files:
* /System/Library/Frameworks/Python.framework/Versions/2.6/bin/sip
* /Library/Python/2.6/site-packages/sip.so
* /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/sip.h
* /Library/Python/2.6/site-packages/sipconfig.py
* /Library/Python/2.6/site-packages/sipdistutils.py
==== 4. Install PyQt (from source) ====
http://www.riverbankcomputing.co.uk/software/pyqt/download
{{{
~/Downloads/PyQt-mac-gpl-4.7.3
$ python configure.py
$ make
$ sudo make install
}}}
installed files:
* /Library/Python/2.6/site-packages/PyQt4
* /System/Library/Frameworks/Python.framework/Versions/2.6/share/sip/PyQt4
* /System/Library/Frameworks/Python.framework/Versions/2.6/bin/pyuic4
* /System/Library/Frameworks/Python.framework/Versions/2.6/bin/pylupdate4
* /System/Library/Frameworks/Python.framework/Versions/2.6/bin/pyrcc4
* /usr/local/Qt4.6/qsci/api/python/PyQt4.api
You may need to add /System/Library/Frameworks/Python.framework/Versions/2.6/bin to PATH; or create symlink to them:
{{{
/usr/local/bin
$ for name in pyuic4 pylupdate4 pyrcc4; do sudo ln -s ../../../System/Library/Frameworks/Python.framework/Versions/2.6/bin/$name; done
}}}
Also, PyQt4 will install versions of pyuic4 for both Python 2 and Python 3, and py2app will find the wrong version when both are present. To work around this problem, simply delete the /Library/Python/2.6/site-packages/PyQt4/uic/port_v3 directory. If you see an error in proxy_base.py when attempting to build, you most likely did not delete the port_v3 directory.
==== 5. Install Python binding for QScintilla ====
{{{
~/Downloads/QScintilla-gpl-2.4.3
$ cd Python
$ python configure.py
$ make
$ sudo make install
}}}
installed files:
* /System/Library/Frameworks/Python.framework/Versions/2.6/share/sip/PyQt4/Qsci
* /usr/local/Qt4.6/qsci/api/python/QScintilla2.api
==== 6. Test installation ====
{{{
# Only for Snow Leopard (10.6) users who installed 32bit Qt:
$ export VERSIONER_PYTHON_PREFER_32_BIT=yes
$ python
Python 2.6.1 (r261:67515, Feb 11 2010, 00:51:29)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtGui import *
>>> app = QApplication([])
>>> w = QDialog()
>>> w.show()
>>> app.exec_()
}}}
=== Optional Dependencies ===
* Install iniparse - allows thg to modify your configuration files
* install pygments - enables auto-completion of source in commit tool
=== Get Latest Mercurial and TortoiseHg ===
{{{
~/Documents
$ hg clone http://selenic.com/repo/hg mercurial
$ hg clone http://bitbucket.org/tortoisehg/thg/
$ cd mercurial
$ make local
}}}
Add {{{~/Documents/mercurial}}} to PYTHONPATH, or symlink to them:
{{{
~/Documents/thg
$ ln -s ../mercurial/mercurial
$ ln -s ../mercurial/hgext
}}}
Run it:
{{{
# Only for Snow Leopard (10.6) users who installed 32bit Qt:
$ export VERSIONER_PYTHON_PREFER_32_BIT=yes
$ thg log
}}}
Happy Hacking!
----
== Install from Source for OS X 10.11 (El Capitan) ==
=== Dependencies: PyQt and QScintilla ===
==== 0. Install Apple Development Tools (Xcode) ====
https://developer.apple.com/xcode/download/
and install Command Line Developer Tools
{{{
xcode-select --install
}}}
==== 1. Install Qt4 (Qt SDK for Mac) ====
Unfortunately, there is no binary available for OS X 10.11 from Qt site.
To build Qt 4.8.7 from sources:
Direct access via
http://download.qt.io/official_releases/qt/4.8/4.8.7/qt-everywhere-opensource-src-4.8.7.tar.gz
{{{
cd /tmp
gunzip qt-everywhere-opensource-src-4.8.7.tar.gz
tar xvf qt-everywhere-opensource-src-4.8.7.tar
cd /tmp/qt-everywhere-opensource-src-4.8.7
}}}
As Qt is using CMGetProfileByAVID() and CMCloseProfile() functions which are not more
available in El Capitan, you need to patch src/gui/painting/qpaintengine_mac.cpp
according to https://github.com/Homebrew/patches/tree/master/qt/el-capitan.patch
{{{
./configure -nomake examples # at least one example is no more compiling on El Capitan)
make # to speed up, you can use -j option (see man make)
sudo make -j1 install
}}}
Modify your .profile file
{{{
PATH=/usr/local/Trolltech/Qt-4.8.7/bin:$PATH
export PATH
}}}
==== 2. Install QScintilla (from source) ====
http://www.riverbankcomputing.co.uk/software/qscintilla/download
{{{
~/Downloads/QScintilla-gpl-2.9.1
$ cd Qt4Qt5
$ qmake -spec macx-g++
$ make
$ sudo make install
}}}
installed files:
* /usr/local/Trolltech/Qt-4.8.7/include/Qsci
* /usr/local/Trolltech/Qt-4.8.7/translations/qscintilla_*
* /usr/local/Trolltech/Qt-4.8.7/lib/libqscintilla*
* /usr/local/Trolltech/Qt-4.8.7/qsci
* /usr/local/Trolltech/Qt-4.8.7/mkspecs/features/qscintilla2.prf
(Optionally) install Qt Designer plugin:
{{{
~/Downloads/QScintilla-gpl-2.9.1
$ cd designer-Qt4Qt5
$ qmake -spec macx-g++
$ make
$ sudo make install
}}}
installed files:
* /usr/local/Trolltech/Qt-4.8.7/plugins/designer/libqscintillaplugin.dylib
==== 3. Install Sip (from source) ====
http://www.riverbankcomputing.co.uk/software/sip/download
{{{
~/Downloads/sip-4.17
$ python configure.py -b /Library/Frameworks/Python.framework/Versions/2.7/bin -e /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -v /Library/Frameworks/Python.framework/Versions/2.7/share/sip
$ make
$ sudo make install
}}}
Attention: as you are no more allowed to add, modify, remove files in /System
due to activation of SIP (System Integrity Protection: https://support.apple.com/en-us/HT204899),
the configuration of the installation needs to be customized.
installed files:
* /Library/Frameworks/Python.framework/Versions/2.7/bin/sip
* /Library/Python/2.7/site-packages/sip.so
* /Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/sip.h
* /Library/Python/2.7/site-packages/sipconfig.py
* /Library/Python/2.7/site-packages/sipdistutils.py
You may need to add /Library/Frameworks/Python.framework/Versions/2.7/bin to PATH; or create symlink to them:
{{{
/usr/local/bin
$ sudo ln -s ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/sip
}}}
==== 4. Install PyQt (from source) ====
http://www.riverbankcomputing.co.uk/software/pyqt/download
{{{
~/Downloads/PyQt-mac-gpl-4.11.4
$ python configure.py -b /Library/Frameworks/Python.framework/Versions/2.7/bin -v /Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4
$ make
$ sudo make install
}}}
installed files:
* /Library/Python/2.7/site-packages/PyQt4
* /Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4
* /Library/Frameworks/Python.framework/Versions/2.7/bin/pyuic4
* /Library/Frameworks/Python.framework/Versions/2.7/bin/pylupdate4
* /Library/Frameworks/Python.framework/Versions/2.7/bin/pyrcc4
* /usr/local/Trolltech/Qt-4.8.7/qsci/api/python/PyQt4.api
You may need to add /Library/Frameworks/Python.framework/Versions/2.7/bin to PATH; or create symlink to them:
{{{
/usr/local/bin
$ for name in pyuic4 pylupdate4 pyrcc4; do sudo ln -s ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/$name; done
}}}
==== 5. Install Python binding for QScintilla ====
{{{
~/Downloads/QScintilla-gpl-2.9.1
$ cd Python
$ python configure.py --sip-incdir=/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 --pyqt-sipdir=/Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4 -v /Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4
$ make
$ sudo make install
}}}
installed files:
* /Library/Python/2.7/site-packages/PyQt4/Qsci.so
* /Library/Frameworks/Python.framework/Versions/2.7/share/sip/PyQt4/Qsci
* /usr/local/Trolltech/Qt-4.8.7/qsci/api/python/QScintilla2.api
==== 6. Test installation ====
{{{
$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PyQt4.QtGui import *
>>> app = QApplication([])
>>> w = QDialog()
>>> w.show()
>>> app.exec_()
}}}
=== Optional Dependencies ===
* Install iniparse - allows thg to modify your configuration files
Due to SIP, you need to specify an allowed destination:
{{{
$ sudo python setup.py install --prefix /Library/Python/2.7/site-packages
}}}
* install pygments - enables auto-completion of source in commit tool
=== Get Latest Mercurial and TortoiseHg ===
{{{
~/Documents
$ hg clone http://selenic.com/repo/hg mercurial
$ hg clone http://bitbucket.org/tortoisehg/thg/
$ cd mercurial
$ make local
}}}
Add {{{~/Documents/mercurial}}} to PYTHONPATH, or symlink to them:
{{{
~/Documents/thg
$ ln -s ../mercurial/mercurial
$ ln -s ../mercurial/hgext
}}}
Run it:
{{{
$ thg log
}}}
or on a Mac Retina, you may need to:
{{{
$ THG_RETINA=True thg log
}}}
Happy Hacking!
----
== Install via Fink ==
TortoiseHg is now available in [[http://www.finkproject.org/|fink]]'s unstable tree, as tortoisehg-py27 (or 25 or 26 if you are using an older python for some reason). You can get it prebuilt for 10.8 from @brendan's unofficial apt repository for fink by adding {{{deb http://brendan.users.finkproject.org/10.8 stable main}}} to {{{/sw/etc/apt/sources.conf}}}. After adding the repository, {{{apt-get update}}} and {{{apt-get install tortoisehg-py27}}}.
----
== Install via Homebrew ==
**Note:** Qt now comes pre-compiled with homebrew. So installing TortoiseHg is much faster than it used to be.
**Note:** PyQt4 has been removed from mainline Homebrew, so the instructions have changed
=== Step 1. Install homebrew ===
* Install XCode via [[http://itunes.apple.com/us/app/xcode/id497799835|AppStore]] or XCode command line tools via [[https://developer.apple.com/downloads/]] (required by Homebrew)
* Install [[http://mxcl.github.com/homebrew/|Homebrew]]
* Add Homebrew's paths to ##$PATH## and ##$PYTHONPATH##:
{{{
#!sh
# Edit ~/.bash_profile or ~/.bashrc
# Add these lines (or adjust them)
BREW_PREFIX=`brew --prefix`
export PATH=$BREW_PREFIX/share/python:$BREW_PREFIX/bin/:$BREW_PREFIX/sbin:$PATH
export PYTHONPATH=$BREW_PREFIX/lib/python2.7/site-packages:$PYTHONPATH
}}}
=== Step 2. Install PyQt4 ====
* Follow instructions at https://github.com/cartr/homebrew-qt4
{{{
brew tap cartr/qt4
brew tap-pin cartr/qt4
brew install qt@4
}}}
* install pyqt4 from this tap
{{{
brew install pyqt@4
}}}
* pin qt and sip to prevent breakage from updates
{{{
brew pin sip qt qt@4 pyqt@4
}}}
* Install QScintilla via source. Download QScintilla_gpl-2.10.1.tar.gz from Riverbank
{{{
$ cd QScintilla_gpl-2.10.1/Qt4Qt5
$ /usr/local/Cellar/qt@4/4.8.7_1/bin/qmake
$ make install
$ cd ../Python
$ python configure.py --pyqt=PyQt4 --pyqt-sipdir=/usr/local/Cellar/pyqt@4/4.12_1/share/sip/
$ make install
}}}
* Install required Python packages:
{{{
$ easy_install pip
$ pip install -U Pygments iniparse mercurial
}}}
* Checkout TortoiseHg (using Mercurial):
{{{
$ hg clone http://bitbucket.org/tortoisehg/thg/ ~/Documents/TortoiseHg
$ cd ~/Documents/TortoiseHg
$ hg update stable # or hg update
}}}
Now you should be able to start TortoiseHg:
{{{
$ ./thg log
}}}
The final step is to "create" a "wrapper app bundle" for your Mac OS X applications folder. Simply checkout [[https://bitbucket.org/skrysmanski/thg-mac-app|this repository]] and copy the app bundle it contains to your Applications folder.
//Note:// If you've checked out TortoiseHg to ##~/Documents/TortoiseHg##, this app should work out of the box. Otherwise you need to read the readme file included in the repository.
==== Troubleshooting the Homebrew alternative ====
* If there is an error about missing git repository, try to update Homebrew first: ##$ brew update##
* If you get ##ImportError: No module named PyQt4.uic.Compiler##, make sure Homebrew's Python path is in ##$PYTHONPATH##.
----
== Install via MacPorts ==
**Warning:** Installing TortoiseHg this way usually takes //a couple of hours// because Qt is compiled from its sources.
* Install XCode (Version 3.x is free and works)
* Install Java Developer Package Update 4 (https://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20719)
* Install MacPorts (http://www.macports.org/install.php)
* Install Python and PyQt from ports:
{{{
$ sudo port install python27 python_select
# Make this the default version
# Old version: $ sudo python_select python27
# New version:
$ sudo port select python python27
$ sudo port install py27-pyqt4 py27-qscintilla
}}}
* Set " /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin" to your Path (edit //~/.bash_profile//)
* Install pip (if not present)
{{{
$ curl -O http://python-distribute.org/distribute_setup.py
$ sudo python distribute_setup.py
$ sudo easy_install pip
}}}
* Install the easy_installable thg fork
{{{
$ sudo pip install thg-mac
}}}