<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Guillaume Piot &#124; Application Developer &#38; User Interface Designer &#187; Mac OSX Lion</title>
	<atom:link href="http://gpiot.com/category/development-tips/mac-osx-lion/feed/" rel="self" type="application/rss+xml" />
	<link>http://gpiot.com</link>
	<description></description>
	<lastBuildDate>Tue, 30 Apr 2013 08:42:21 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Django internationalization on OSX Lion</title>
		<link>http://gpiot.com/django-internationalization-on-osx-lion/</link>
		<comments>http://gpiot.com/django-internationalization-on-osx-lion/#comments</comments>
		<pubDate>Wed, 06 Jun 2012 14:42:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Mac OSX Lion]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=484</guid>
		<description><![CDATA[Django has excellent support for website internationalization. We will now focus on the languages side of things. First of all, we need to make sure that our Mac has the right library to generate translation files. Installing gettext If you [...]]]></description>
			<content:encoded><![CDATA[<p>Django has excellent support for website internationalization. We will now focus on the languages side of things.</p>
<p>First of all, we need to make sure that our Mac has the right library to generate translation files.</p>
<h2>Installing gettext</h2>
<p>If you run the following command in Terminal:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ django-admin.py makemessages -a</div></td></tr></tbody></table></div>
<p>You will probably get the following error</p>
<p><span style="color: #ff0000;">/bin/sh: xgettext: command not found</span></p>
<p>The reason for this is that the <strong>gettext</strong> library is not installed.</p>
<h3>Installation from source (#fail)</h3>
<p>I have tried to <a href="http://ftp.gnu.org/pub/gnu/gettext/gettext-0.18.1.1.tar.gz">download the gettext source</a> (if not available, check the gettext site: <a href="http://www.gnu.org/software/gettext/">www.gnu.org/software/gettext/</a>)</p>
<p>Uncompress the package in finder, then in Terminal cd to it:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ cd /your/path/gettext-0.18.1.1<br />
$ ./configure<br />
$ make<br />
$ make install</div></td></tr></tbody></table></div>
<p>But then I got the following error:</p>
<p><span style="color: #ff0000;">stpncpy.c:34: error: expected declaration specifiers or ‘&#8230;’ before numeric constantstpncpy.c:34: error: expected ‘)’ before ‘!=’ token</span><br />
<span style="color: #ff0000;"> stpncpy.c:34: error: expected ‘)’ before ‘?’ token</span><br />
<span style="color: #ff0000;"> make[3]: *** [stpncpy.lo] Error 1</span><br />
<span style="color: #ff0000;"> make[2]: *** [install] Error 2</span><br />
<span style="color: #ff0000;"> make[1]: *** [install-recursive] Error 1</span><br />
<span style="color: #ff0000;"> make: *** [install-recursive] Error 1</span></p>
<p>It seems like it won&#8217;t compile on Lion. So here&#8217;s the other way.</p>
<h3>Installation with Homebrew</h3>
<p>So instead I&#8217;m installing it using H<a href="http://mxcl.github.com/homebrew/">omebrew</a> (a package installer for Mac OS), follow those <a href="https://github.com/mxcl/homebrew/wiki/installation">instructions</a> to install it.</p>
<p>Once brew is installed, run the following command:</p>
<p><span style="color: #000000;"></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ brew install gettext<br />
$ sudo brew link gettext</div></td></tr></tbody></table></div>
<p></span></p>
<p><strong>Then you MUST add that package to your path:</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$echo 'export PATH=/usr/local/Cellar/gettext/0.18.1.1/bin:$PATH' &amp;gt;&amp;gt; ~/.profile</div></td></tr></tbody></table></div>
<p>* Make sure that your path is correct as well!</p>
<p>Or you will get the following error:<br />
/bin/sh: msguniq: command not found</p>
<p>We should be good to go to the next step now.</p>
<h2>Generating language files</h2>
<p>One thing the Django admin command won&#8217;t do, is creating the locale folders. So in your project directory (or app directory) add the following folder structure (one for each language):</p>
<p><a href="http://gpiot.com/wp-content/uploads/2012/06/Screen-Shot-2012-06-06-at-15.10.55.png"><img class="alignnone size-full wp-image-491" title="Screen Shot 2012-06-06 at 15.10.55" src="http://gpiot.com/wp-content/uploads/2012/06/Screen-Shot-2012-06-06-at-15.10.55.png" alt="" width="513" height="109" /></a></p>
<p>Those folder will indicate in which language your project needs to be localised. Then run the following command to generate the language files</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ django-admin.py makemessages -a</div></td></tr></tbody></table></div>
<p>This command will compile all the languages at once (for more specific command check the <a href="https://docs.djangoproject.com/en/1.4/topics/i18n/translation/">Django docs</a>).</p>
<p>So you will get something like that:</p>
<p><a href="http://gpiot.com/wp-content/uploads/2012/06/Screen-Shot-2012-06-06-at-15.33.10.png"><img class="alignnone size-full wp-image-499" title="Screen Shot 2012-06-06 at 15.33.10" src="http://gpiot.com/wp-content/uploads/2012/06/Screen-Shot-2012-06-06-at-15.33.10.png" alt="" width="466" height="206" /></a></p>
<p>The PO file contains the original translation string followed byt the translated one (French example):</p>
<p><em>#: map/forms.py:9</em><br />
<em> msgid &#8220;Hello&#8221;</em><br />
<em> msgstr &#8220;Bonjour&#8221;</em></p>
<p>Once you (or the translator) have completed all the translations in that PO file, you can run the <strong>compile command:</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">$ django-admin.py compilemessages</div></td></tr></tbody></table></div>
<p>It will generate the compiled MO files, which will be used by Django for translating all the texts.</p>
<p><a href="http://gpiot.com/wp-content/uploads/2012/06/Screen-Shot-2012-06-06-at-15.37.18.png"><img class="alignnone size-full wp-image-502" title="Screen Shot 2012-06-06 at 15.37.18" src="http://gpiot.com/wp-content/uploads/2012/06/Screen-Shot-2012-06-06-at-15.37.18.png" alt="" width="451" height="257" /></a></p>
<p>You will have run the makemessages command everytime you had or modify transalted string in your app, then compile everytime you change the translations.</p>
<h2>Translation helper</h2>
<p>I&#8217;ve been using a great Django app to handle translation easily, called <a href="https://github.com/mbi/django-rosetta">Rosetta</a>. It will make form fields in your admin for each translation, which ease the process rather than going through a really long text file.</p>
<p>Happy translating!</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/django-internationalization-on-osx-lion/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mac OS X Lion: The perfect setup for Python / Django</title>
		<link>http://gpiot.com/mac-os-x-lion-the-perfect-setup-for-python-django/</link>
		<comments>http://gpiot.com/mac-os-x-lion-the-perfect-setup-for-python-django/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 15:29:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Django]]></category>
		<category><![CDATA[Mac OSX Lion]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[OSX Lion]]></category>

		<guid isPermaLink="false">http://gpiot.com/?p=252</guid>
		<description><![CDATA[If like me, you are developing Django applications on a Mac, you will probably face a few issues when upgrading to Lion. In my case, I haven&#8217;t even upgraded, I decided to wipe it all out and start from a [...]]]></description>
			<content:encoded><![CDATA[<p>If like me, you are developing Django applications on a Mac, you will probably face a few issues when upgrading to Lion. In my case, I haven&#8217;t even upgraded, I decided to wipe it all out and start from a fresh installation (my MacBook hard disk did thank me for it!).</p>
<p>So here we go, I&#8217;ve put down the stepped I have followed to get my setup back to business.</p>
<p>First of all, Mac OS X Lion now ships with Python 2.7 already installed which is the version we will use.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">guillaumepiot$ python -V<br />
<br />
Python 2.7.1</div></td></tr></tbody></table></div>
<p>Also, you will need some development libraries to be installed, for that download <strong>XCode</strong> from the App Store. <strong>Then browse to your Applications folder and install XCode. </strong>Yes it&#8217;s a bit silly that it doesn&#8217;t install itself automatically, I got caught the first time!</p>
<p><a href="http://gpiot.com/wp-content/uploads/2011/09/Screen-Shot-2011-09-21-at-15.41.50.png"><img class="alignnone size-full wp-image-278" title="Screen Shot 2011-09-21 at 15.41.50" src="http://gpiot.com/wp-content/uploads/2011/09/Screen-Shot-2011-09-21-at-15.41.50.png" alt="" width="370" height="95" /></a></p>
<p><span style="color:#ff0000">Update: When installing Xcode, you may have to install the command line tools as well</span></p>
<h2>Install MySQL</h2>
<p>Download the MySQL installation package:</p>
<p><a href="http://www.mysql.com/downloads/mirror.php?id=403751#mirrors">Mac OS X ver. 10.6 (x86, 64-bit), DMG Archive</a></p>
<p>Install the app as you normally would, double-click the DMG file and follow the instructions.</p>
<p>I recommend to install the 3 items: the <strong>main package</strong>, the <strong>startup item</strong> and the <strong>preference panel widget</strong> (for added control in  your System Preferences).</p>
<p>Once it&#8217;s all installed, go to your System Preferences, go to MySQL, and start the server.</p>
<p><strong>Setup MySQL users:</strong></p>
<p>First, we want to reset the root password.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysqladmin -u root password NEWPASSWORD</div></td></tr></tbody></table></div>
<p>Then, I like to create a personal user for connecting locally (rather than connecting with root).</p>
<p>Start MySQL:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">/usr/local/mysql/bin/mysql -u root -p</div></td></tr></tbody></table></div>
<p>(Then enter your root password)</p>
<p>Create a new user and assign it all privileges on all databases, or on a specific database (up to you!).</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">mysql&gt; CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';<br />
<br />
mysql&gt; GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';</div></td></tr></tbody></table></div>
<p><em>Tips: I like to use <a href="http://www.sequelpro.com/">Sequel Pro</a> to manage my database and users, rather than using the command line. If you are re-intalling Sequel Pro, you may want to copy and move you favourites from that path, from one machine to another: ~/Library/Preferences/com.google.code.sequel-pro.plist</em></p>
<h2>Install the Python libraries</h2>
<p><strong>Install Setup Tools:</strong></p>
<p>First, we&#8217;ll need Setup Tools to help us installing the next packages. Download <a href="http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5=7df2a529a074f613b509fb44feefe74e">Setup Tools</a>.</p>
<p>Un-compress, cd /to folder, and run:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo python setup.py install</div></td></tr></tbody></table></div>
<p><strong>Install Django:</strong></p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo easy_install django</div></td></tr></tbody></table></div>
<p>Verify that python is installed properly:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">python<br />
<br />
import django</div></td></tr></tbody></table></div>
<p><strong>Install MySQLdb:</strong></p>
<p>Download the package here: <a href="http://sourceforge.net/projects/mysql-python/">MySQL-Python</a></p>
<p>Untar the package, then we&#8217;ll need to edit the config file to add the right path to MySQL bin. Edit site.cfg and change the following:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"># The path to mysql_config.<br />
# Only use this if mysql_config is not on your PATH, or you have some weird<br />
# setup that requires it.<br />
mysql_config = /usr/local/mysql/bin/mysql_config</div></td></tr></tbody></table></div>
<p>Then, cd /to folder, and run:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">sudo python setup.py install</div></td></tr></tbody></table></div>
<p>Once it&#8217;s installed, try to load it:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">import MySQLdb</div></td></tr></tbody></table></div>
<p>It&#8217;s likely you will come with the following error:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Library not loaded: libmysqlclient.18.dylib</div></td></tr></tbody></table></div>
<p>Here&#8217;s how I fixed it, add the following to your ~/.profile or ~/.bash_profile:</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">vi ~/.profile (to edit the file)</div></td></tr></tbody></table></div>
<p>Insert the following line:</p>
<div>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">export DYLD_LIBRARY_PATH=/usr/local/mysql/lib:$DYLD_LIBRARY_PATH</div></td></tr></tbody></table></div>
</div>
<div>Save the file and then re-open a new Terminal window for the changes to take effect!</div>
<p>That should be fixed!</p>
<h2>What next?</h2>
<p>Well that&#8217;s it for the basic, you can now run a simple Django App (like my <a href="https://bitbucket.org/guillaumepiot/django-ajax-poll">Django Poll App</a> for example!)</p>
<p>If you need more packages installed, then proceed as usual.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/mac-os-x-lion-the-perfect-setup-for-python-django/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		</item>
		<item>
		<title>Create a new Mercurial repository on Mac</title>
		<link>http://gpiot.com/create-a-new-mercurial-repository-on-mac/</link>
		<comments>http://gpiot.com/create-a-new-mercurial-repository-on-mac/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 17:03:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac OSX Lion]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[Mercurial]]></category>

		<guid isPermaLink="false">http://piot.co.uk/?p=197</guid>
		<description><![CDATA[Every months or so, I create a new repository for the development project I work on. But I always tend to forget how to setup the repository, so here&#8217;s a quick start quide which I found very helpful and I [...]]]></description>
			<content:encoded><![CDATA[<p>Every months or so, I create a new repository for the development project I work on. But I always tend to forget how to setup the repository, so here&#8217;s a quick start quide which I found very helpful and I hope you will too.</p>
<h2>1. First of all, we need to create a username file: <strong>.hgrc</strong></h2>
<p>Include the following text:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[ui]<br />
username = Your Name &lt;yourname@domain.com&gt;</div></td></tr></tbody></table></div>
</p>
<p>Save it under you home folder eg:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Guillaumes-MacBook-Pro: guillaumepiot$ cat ~/.hgrc<br />
[ui]<br />
username = Your Name &lt;yourname@domain.com&gt;</div></td></tr></tbody></table></div>
</p>
<p>This command should return the content of the file.</p>
<p>&nbsp;</p>
<h2>2. Go to your project folder</h2>
<p>cd /my/folder</p>
<p>Start the repo:</p>
<p>hg init</p>
<p>* You can create a .hgignore file inside the .hg folder (make sure your hidden files are showing). This file will ignore a list of extension for example:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">syntax: glob<br />
*.pyc<br />
*.txt</div></td></tr></tbody></table></div>
</p>
<p>This will ignore Python compiled files and txt files.</p>
<h2>3. Add project files to the repo:</h2>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hg add</div></td></tr></tbody></table></div>
</p>
<p>or</p>
<p>hg addremove (if you set up your ignore file after the init)</p>
<h2>4. Commit your work:</h2>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hg commit -m 'Explain here the reason of this commit'</div></td></tr></tbody></table></div>
</p>
<p>This will create a new commit, the message explained what has been added or modified.</p>
<h2>5. Push you work to the repository:</h2>
<p>I advice to create a file with default settings for convenience, which will stop you from entering the repo URL each time.</p>
<p>In the <strong>.hg</strong> folder, create a file called <strong>hgrc</strong> and put the following:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[paths]<br />
default-push = ssh://hg@codebasehq.com/vivaaspire/viva-website/hotel_innovation_network.hg&lt;br /&gt;&lt;br /&gt;</div></td></tr></tbody></table></div>
</p>
<p>Then push:</p>
<p><div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">hg push</div></td></tr></tbody></table></div>
</p>
<p>It should be all set now.</p>
<p>This is a very basic startup guide, there&#8217;s many things you can do an option but that I recommend you check the Mercurial website: <a href="http://mercurial.selenic.com/">http://mercurial.selenic.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://gpiot.com/create-a-new-mercurial-repository-on-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
