<?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>Patrick&#039;s playground &#187; Mac OS X</title>
	<atom:link href="http://www.vankouteren.eu/blog/tag/mac-osx/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vankouteren.eu/blog</link>
	<description>Random thoughts, problems and solutions</description>
	<lastBuildDate>Sun, 29 Jan 2012 07:53:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Getting IPython readline and auto-completion to work on Mac OS X</title>
		<link>http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/</link>
		<comments>http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 12:11:01 +0000</pubDate>
		<dc:creator>Patrick van Kouteren</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[auto-complete]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[readline]]></category>

		<guid isPermaLink="false">http://www.vankouteren.eu/blog/?p=98</guid>
		<description><![CDATA[It's taken me some time and a lot of web pages which tried to solve the readline support with all kinds of hacks, but finally I've been able to get readline support and auto-completion for IPython to work. As it can be quite confusing and hard to follow all posts, this will be a step-by-step [...]]]></description>
			<content:encoded><![CDATA[<p>It's taken me some time and a lot of web pages which tried to solve the readline support with all kinds of hacks, but finally I've been able to get readline support and auto-completion for IPython to work. As it can be quite confusing and hard to follow all posts, this will be a step-by-step approach to get things to work. Note that I've got it working on Mac OS X 10.5.7 Leopard. It is expected to work on Leopard at least. Other versions might not require the exact same solution.</p>
<p><span id="more-98"></span></p>
<p>If you don't already have IPython you can install it by opening a console and typing</p>
<pre>sudo easy_install ipython</pre>
<p>Mac OS X does include a readline functionality, but not 'the real one' gnureadline, because of a license issue. It can be manually installed, which we will do next. If you've not done so already, open a console and type</p>
<pre>sudo easy_install -f http://ipython.scipy.org/dist/ readline</pre>
<p>Type in your password and the readline functionality will be installed. Big joy you would think, but it's very well possible that it still doesn't work. Try for yourself by typing the following in your console:</p>
<pre>ipython</pre>
<p>IPython will start. Let's see if we can auto-complete here. First type</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span></pre>
<p>Now we've done an import and we will try to have auto-complete hint what we can do with it. In the next line type</p>
<pre class="python"><span style="color: #dc143c;">sys</span>.</pre>
<p>Press Tab directly after the dot. If IPython hints all types of functions preceded by sys. in a list, you're done with this tutorial. If your cursor just jumps, auto-complete doesn't work and you might want to execute the following steps.<br />
IPython has a file which is used to start it. We need to edit this file to tell where the readline module is installed.<br />
If you're still in IPython, close it by pressing CTRL+D and confirming (y). You are now back on the console again.<br />
The file which we are about to edit (done with Vim here) is a read-only file, so we need to sudo once again. Type the following</p>
<pre>sudo vim /usr/local/bin/ipython</pre>
<p>Enter your password and Vim will open a config file with just a few lines like</p>
<pre class="python"><span style="color: #808080; font-style: italic;">#!/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python</span>
<span style="color: #808080; font-style: italic;"># EASY-INSTALL-ENTRY-SCRIPT: 'ipython==0.9.1','console_scripts','ipython'</span>
__requires__ = <span style="color: #483d8b;">'ipython==0.9.1'</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #ff7700;font-weight:bold;">from</span> pkg_resources <span style="color: #ff7700;font-weight:bold;">import</span> load_entry_point
&nbsp;
<span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span>
   load_entry_point<span style="color: black;">&#40;</span><span style="color: #483d8b;">'ipython==0.9.1'</span>, <span style="color: #483d8b;">'console_scripts'</span>, <span style="color: #483d8b;">'ipython'</span><span style="color: black;">&#41;</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
<span style="color: black;">&#41;</span></pre>
<p>First find the location of the egg directory of readline which you've just installed. It's probably something like /Library/Python/site-packages/readline-.egg<br />
I've installed the i386 readline module version 2.5.1, so my location is /Library/Python/2.5/site-packages/readline-2.5.1-py2.5-macosx-10.5-i386.egg<br />
We will need this location next.<br />
Go back to your console where the file is still opened.<br />
Leave the first two lines and the import sys line. The rest can be commented out.<br />
Now insert the following three lines after import sys:</p>
<pre class="python"><span style="color: #dc143c;">sys</span>.<span style="color: black;">path</span>.<span style="color: black;">insert</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #483d8b;">'path to readline egg'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">import</span> IPython.<span style="color: black;">Shell</span>
IPython.<span style="color: black;">Shell</span>.<span style="color: black;">start</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">mainloop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre>
<p>In my case, the ipython file looks as follows:</p>
<pre class="python"><span style="color: #808080; font-style: italic;">#!/System/Library/Frameworks/Python.framework/Versions/2.5/Resources/Python.app/Contents/MacOS/Python</span>
<span style="color: #808080; font-style: italic;"># EASY-INSTALL-ENTRY-SCRIPT: 'ipython==0.9.1','console_scripts','ipython'</span>
<span style="color: #808080; font-style: italic;">#__requires__ = 'ipython==0.9.1'</span>
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
<span style="color: #808080; font-style: italic;">#from pkg_resources import load_entry_point</span>
&nbsp;
<span style="color: #dc143c;">sys</span>.<span style="color: black;">path</span>.<span style="color: black;">insert</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span>, <span style="color: #483d8b;">'/Library/Python/2.5/site-packages/readline-2.5.1-py2.5-macosx-10.5-i386.egg'</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">import</span> IPython.<span style="color: black;">Shell</span>
IPython.<span style="color: black;">Shell</span>.<span style="color: black;">start</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">mainloop</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#sys.exit(</span>
<span style="color: #808080; font-style: italic;">#   load_entry_point('ipython==0.9.1', 'console_scripts', 'ipython')()</span>
<span style="color: #808080; font-style: italic;">#)</span></pre>
<p>Save and quit the file by typing</p>
<pre class="bash">:wq</pre>
<p>You're back at the command line again. Let's test the auto-complete. Again type</p>
<pre>ipython</pre>
<p>IPython will start. Let's see if we can auto-complete here. First type</p>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span></pre>
<p>Now we've done an import and we will try to have auto-complete hint what we can do with it. In the next line type</p>
<pre class="python"><span style="color: #dc143c;">sys</span>.</pre>
<p>Press Tab directly after the dot. If all went well Python hints all types of functions preceded by sys. in a list.</p>
<p><strong>Sites that helped me and / or might be useful for you:</strong></p>
<ul>
<li><a title="IPython on Mac OS X" href="http://hurley.wordpress.com/2008/11/15/ipython-on-mac-os-x/" target="_blank">IPython on Mac OS X</a></li>
<li><a title="Incredible Vehicle" href="http://incrediblevehicle.com/2009/06/11/readline-python-ipython-and-mac-os-x/" target="_blank">Incredible Vehicle</a></li>
<li><a title="Launchpad" href="https://bugs.launchpad.net/ipython/+bug/254023" target="_blank">Launchpad</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.vankouteren.eu/blog/2009/06/getting-ipython-readline-and-auto-completion-to-work-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Installing psycopg2 on Mac OS X</title>
		<link>http://www.vankouteren.eu/blog/2009/06/installing-psycopg2-on-mac-os-x/</link>
		<comments>http://www.vankouteren.eu/blog/2009/06/installing-psycopg2-on-mac-os-x/#comments</comments>
		<pubDate>Tue, 23 Jun 2009 13:06:08 +0000</pubDate>
		<dc:creator>Patrick van Kouteren</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[psycopg2]]></category>

		<guid isPermaLink="false">http://www.vankouteren.eu/blog/?p=90</guid>
		<description><![CDATA[I thought I had psycopg2 installed on my mac.. Thought.. But now I actually have! After a quick search I found the right solution here. It only needed a little bit adjustment as I don't use PostgresPlus, but just plain PostgreSQL. To install, type the following in your command line. (Note that I use PostgreSQL [...]]]></description>
			<content:encoded><![CDATA[<p>I thought I had psycopg2 installed on my mac.. Thought.. But now I actually have!</p>
<p><span id="more-90"></span></p>
<p>After a quick search I found the right solution <a title="Installing psycopg2 on Mac OS X" href="http://blog.jonypawks.net/2008/06/20/installing-psycopg2-on-os-x/" target="_blank">here</a>. It only needed a little bit adjustment as I don't use PostgresPlus, but just plain PostgreSQL.</p>
<p>To install, type the following in your command line. (Note that I use PostgreSQL 8.3 here! For different versions, different folders can hold, like /8.2 instead of /8.3 for PostgreSQL 8.2 for example).</p>
<pre>PATH=$PATH:/Library/PostgreSQL/8.3/bin/ sudo easy_install psycopg2</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.vankouteren.eu/blog/2009/06/installing-psycopg2-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Installing Numpy on Mac OS X 10.5.x Leopard</title>
		<link>http://www.vankouteren.eu/blog/2009/05/installing-numpy-on-mac-os-x-105x-leopard/</link>
		<comments>http://www.vankouteren.eu/blog/2009/05/installing-numpy-on-mac-os-x-105x-leopard/#comments</comments>
		<pubDate>Thu, 14 May 2009 09:16:46 +0000</pubDate>
		<dc:creator>Patrick van Kouteren</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[intel mac]]></category>
		<category><![CDATA[numpy]]></category>
		<category><![CDATA[scipy]]></category>

		<guid isPermaLink="false">http://www.vankouteren.eu/blog/?p=79</guid>
		<description><![CDATA[Installing Numpy according to the Scipy wiki page can be a real pain. As Python and GCC are already part of Mac OS X, some prerequisites are already fulfilled, but an official install didn't do the trick in my case. When running the advised tests: python import numpy numpy.test&#40;'1','10'&#41; import scipy scipy.test&#40;'1','10'&#41; I immediately had [...]]]></description>
			<content:encoded><![CDATA[<p>Installing Numpy according to the <a title="Scipy wiki: installing Scipy and Numpy" href="http://www.scipy.org/Installing_SciPy/Mac_OS_X" target="_blank">Scipy wiki page</a> can be a real pain. As Python and GCC are already part of Mac OS X, some prerequisites are already fulfilled, but an official install didn't do the trick in my case.<span id="more-79"></span></p>
<p>When running the advised tests:</p>
<pre>python</pre>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> numpy
numpy.<span style="color: #dc143c;">test</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'1'</span>,<span style="color: #483d8b;">'10'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">import</span> scipy
scipy.<span style="color: #dc143c;">test</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'1'</span>,<span style="color: #483d8b;">'10'</span><span style="color: black;">&#41;</span></pre>
<p>I immediately had problems testing numpy. A little search led me to <a title="Macinscience" href="http://macinscience.org/?page_id=6" target="_blank">Macinscience</a>. Here you can download the <a title="Scipy Superpack installer for Mac OS X Intel" href="http://idisk.mac.com/fonnesbeck-Public/superpack_2009.03.28.sh" target="_blank">Scipy Superpack installer for Mac OS X Intel</a>. Note that according to Macinscience it is also possible to download gFortran <a title="Download gFortran" href="http://r.research.att.com/tools/" target="_blank">elsewhere</a> (as I also did) and download the <a title="Scipy superpack installer without gFortran" href="http://idisk.mac.com/fonnesbeck-Public/superpack_no_fortran_2009.03.28.sh" target="_blank">Scipy Superpack installer</a> which doesn't install gFortran. For both packs hold that these basically are executable SH scripts which downloads the appropriate unofficial files. You can run the superpack script WITH gFortran installer (the other one only has a different name which you should call) through the terminal from your download directory by typing:</p>
<pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sh</span> superpack_2009<span style="color: #000000;">.03</span><span style="color: #000000;">.28</span>.<span style="color: #c20cb9; font-weight: bold;">sh</span></pre>
<p>The downloading will start and you will be prompted for your password eventually. After finishing the installation, the Scipy Superpack will be installed. Please note that the Scipy Superpack is regularly updated. When writing this post, the 2009.03.28 was the most recent version. One can find the latest version on <a title="iDisk containing Scipy Superpack" href="http://idisk.mac.com/fonnesbeck-Public/" target="_blank">this</a> page. Having that said, I again ran the tests:</p>
<pre>python</pre>
<pre class="python"><span style="color: #ff7700;font-weight:bold;">import</span> numpy
numpy.<span style="color: #dc143c;">test</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'1'</span>,<span style="color: #483d8b;">'10'</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">import</span> scipy
scipy.<span style="color: #dc143c;">test</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'1'</span>,<span style="color: #483d8b;">'10'</span><span style="color: black;">&#41;</span></pre>
<p>I got another error with the numpy test. As also suggested in the <a title="Comment: Missing my nose!" href="http://macinscience.org/?page_id=6#comment-2" target="_blank">first comment on the Macinscience post</a>: a library called nose is required. Although the provider replied that it would be in the package in the future, it wasn't present (yet?) in my case. This nose library can additionally be downloaded by typing:</p>
<pre class="bash"><span style="color: #c20cb9; font-weight: bold;">sudo</span> easy_install nose</pre>
<p>After this my tests passed (note that the scipy test can take some time!).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vankouteren.eu/blog/2009/05/installing-numpy-on-mac-os-x-105x-leopard/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cisco VPN Error 51</title>
		<link>http://www.vankouteren.eu/blog/2008/05/cisco-vpn-error-51/</link>
		<comments>http://www.vankouteren.eu/blog/2008/05/cisco-vpn-error-51/#comments</comments>
		<pubDate>Fri, 02 May 2008 12:23:47 +0000</pubDate>
		<dc:creator>Patrick van Kouteren</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[error 51]]></category>
		<category><![CDATA[VPN]]></category>

		<guid isPermaLink="false">http://www.vankouteren.eu/blog/?p=11</guid>
		<description><![CDATA[I was getting annoyed today by my Cisco VPN client unwilling to do its job. As I had been playing around with my Time Capsule and my wireless accesspoint to get my wireless network straight so that it could connect with my Nintendo Wii, I encountered an 'Error 51'. Luckily I wasn't the only one [...]]]></description>
			<content:encoded><![CDATA[<p>I was getting annoyed today by my Cisco VPN client unwilling to do its job. As I had been playing around with my Time Capsule and my wireless accesspoint to get my wireless network straight so that it could connect with my Nintendo Wii, I encountered an 'Error 51'. Luckily I wasn't the only one who got that problem. The first solution already worked:"The simple fix is to quit VPNClient, open a Terminal window, (Applications -&gt; Utilities -&gt; Terminal) and type the following:</p>
<pre>sudo /System/Library/StartupItems/CiscoVPN/CiscoVPN restart</pre>
<p> (for OS X 10.5 and lower) or
<pre>sudo kextload /System/Library/Extensions/CiscoVPN.kext</pre>
<p> (10.6) and give your password when it asks. This will stop and start the "VPN Subsystem", or in other words restart the CiscoVPN.kext extension. Cisco seems to have problems when network adapters disappear and reappear, something that happens commonly in Wireless or Dial-up scenerios. Sometimes putting a system to sleep, disconnecting an Ethernet cable or simply reconnecting your wireless will cause CiscoVPN to loose track of the network adapters on the system."The source can be found <a title="Fix for error 51 Cisco VPN" href="http://www.anders.com/cms/192/CiscoVPN/Error.51:.Unable.to.communicate.with" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vankouteren.eu/blog/2008/05/cisco-vpn-error-51/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

