Tag Archive for 'mac'

Install Python 2.6 with iPython, Numpy, Scipy, Matplotlib on Leopard 10.5

I’ve been through this a few times, sometimes someone else makes it easy, sometimes not. This is somewhere between the two…

  • Get python 2.6 from here and install it. Since I already have a link through to the /System python from /Library/Frameworks/Python.framework it goes in /System/Library/Frameworks/Python.framework/Versions/2.6
  • Get numpy for python 2.6 from here and install it. It goes in /System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/
  • Get scipy for python 2.6 from here and install it. It goes in the same place.
  • Get freetype2 and libpng using fink. These are needed to build matplotlib. You could always try building matplotlib first to see if it works.
  • Get matplotlib from here. There wasn’t a binary for 10.5 when I looked so I had to build it, thus the above step.
  • Build and install matplotlib with the command “python2.6 setup.py build” and then “sudo python2.6 setup.py install”
  • Get easy_install from here, instructions are on the same page. You’ll have to chmod the egg to be executable. This program is great for installing other packages, it’s in the location used below.
  • Install ipython using easy_install with “sudo /Library/Frameworks/Python.framework/Versions/Current/bin/easy_install-2.6 ipython”, it’s in the same place as the easy_install program.

That got me sorted for these packages, however if you wanted to test your installs or numpy and scipy [using numpy.test() and scipy.test()] you need nose, which you can also get with easy_install. You may also want to modify your path or create links to the executables so you don’t have to write the full path into the Framework bin directory.

Since I use python for astronomy I also installed a bunch of other modules including pyFITS, pywcs, vo, and APLpy. Most were found from links on the APLpy website with commands like “sudo /usr/local/bin/python2.6 setup.py install” and APLpy itself with easy_install.

Installing PIL (python imaging library) was a bit trickier, since you need to get the libjpeg and freetype2 libraries (I got them with Fink) first. When you try and build it it’ll likely give errors because the gcc commands include –arch ppc. That can be avoided by executing “export ARCHFLAGS=”-arch i386″ before you build. Also, the selftest craps out, but doesn’t mean that the build didn’t work.

Good luck. I’m not an expert but I find it handy when I find lists like this…

QuickLook plugins

Recently I’ve caught onto QuickLook plugins for my Mac. I went and got the QLColorCode one, which syntax highlights the languages I use that aren’t highlighted by default (i.e. IDL) and also the EPSQLPlugin.

Since the EPS plugin only works for .eps files by default, you can open the EPSQLPlugin.qlgenerator ‘file’ you copied into /Library/QuickLook or ~/Library/QuickLook and then edit the Info.plist file. Add a line below


which reads


Then you’ll get previews of both .eps and .ps files. Yay!

[Unfortunately the preview doesn’t seem to work for .ps files generated by everything. I can preview ones made by PGPLOT but not IDL]

Switch between buttons in Mac OS X

Something that always bugged me about macs was the inability to do without a mouse. Having previously been a long time windows user I was adept enough to be able to do pretty much anything with just a keyboard. On the mac however, various things have always required a mouse, like clicking the OK button on various dialogue boxes.

So in an idle moment I was looking for a way to change the useless §/± button on my euro macbook to be the infinitely more useful ~/` button, and happened across the “Full keyboard access” option in the keyboard and mouse options. Ticking “All controls” allows you to tab between things just like the good old days!

I didn’t find how to change what the §/± button does. I think the euro layout is useless… I wonder if there is a deficit of Perl programmers in this part of the world just because they couldn’t find where the # key was? (and like me haven’t figured out how to type a # in Emacs…)

How to make IDLWave work with Aquamacs and IDL 7.0

[this still applied when I installed IDL8.1]

It took me ages to find why my IDLWave wasn’t working with Aquamacs, and googling terms such as “idlwave aquamacs problem” didn’t help. It turns out the solution is given in a ITT tech tip. You basically have to add the IDL 6.4 help infrastructure to your 7.0 install since IDLWave expects the 6.4 structure.

I also found that putting /Applications/itt/idl/bin in my path was needed to make things work. I don’t know why I couldn’t just set the idlwave-system-directory but it didn’t seem to help. Once you’ve got it going, you do the IDLWAVE->Routine Info->Select Catalog Directories to make IDLWave scan all your directories for personal pro files, and you’re done!

Install Python with iPython, Numpy, Scipy, Matplotlib on Leopard

[now out of date, the macinscience website no longer exists. see a new method for installing python 2.6 with these packages here]

So previously I went through this epic effort to install matplotlib and associated Python stuff on my mac with Leopard. Some time after I noticed that it might be possible to do it in a much easier way. I’ve just done it and it’s great!

Install IDLE if you want it. I don’t even know what it does, but I do know it works. Download the MacPython package, open it up and install the applications. Delete the launcher (and and the build applet if you have Xcode) since you have them already. Part of the IDLE install instructions are to add symbolic link: sudo ln -s /System/Library/Frameworks/Python.framework/ /Library/Frameworks/Python.framework

Get the scipy superpack. This guy in NZ (but not a NZer sadly) has made a script that gets everything for you and puts it in /Library/Python/2.5/site-packages for you. When I installed it it was almost right. As noted in the comments, remove the pyreadline egg and get one with the gnu readline in it. Edit the easy-install.pth file (using sudo) and change the line to reflect the new readline egg.

You’re done!

Setting up my new MacBook Pro

So just scored a new MBP and a 24″ iMac for work. First impression is that the screen on the MBP  is WAY brighter than my old MBP. I thought it might be handy to keep track of everything that needs to happen to get it up to speed… here is the list so far.


There will be plenty more, I haven’t even thought about the Perl modules I need or Python yet, but this is enough to get me started…

Olympus 1030SW video problems

Not that I take videos with my little 1030SW very often, but when I do I’d at least like to be able to play them on my mac. As it was my Finder would crash every time I’d try and preview an AVI, or Aperture would crash on trying to import when these avi’s were present.

It turned out the problem was with the AviImporter Quicktime plugin, which I fixed by replacing it with the Perian plugin (in /Library/QuickTime). Now they play no worries.

Save more space on your Mac

I just remembered my Aperture 2 install came with a bunch of example projects, nearly 3Gb of them in fact. Go delete them from /Macintosh HD/Library/Application Support/Aperture/ to get your quickly disappearing space back…


Save 2Gb on your mac – if you don’t use garageband

If you don’t use garageband on your mac, you can remove all the files in /Library/Application Support/Garageband and get about 2Gb of free space.

Instead of deleting mine, I shifted it to an external hard drive. Next time I started Garageband, it asked me to point to the new location. From googling the issue, it’s not clear whether you can reinstall the files if you delete them permanently. There appear to be some versions of Leopard that came with a second disk that has the files. My Leopard came on a single DVD.

iPod photo cache

Always running out of space on your computer? Have iTunes and an iPod or two, and a lot of photos? I just cleared out 3Gb of thumbnails for my iPods that I never look at. Just remove the folder “iPod Photo Cache” from your iPhoto or Aperture library.


Aperture vault backup speed

I recently realised (from the Aperture forums I think) that for the Aperture vault feature to work nicely one needs to have a Mac OS formatted drive to backup to. Previously my external drive was DOS formatted so I could read it from my PC, and the backup took forever. I also had this problem, which appears to have gone away, though I’m not sure if it was related. Now with my Mac OS Extended partition, the vault backup of my 25Gb library doesn’t even take a minute.

Getting PHP to work after upgrading to Leopard

After getting MySQL going I realised php5 wasn’t doing any better. This problem is caused by new settings for php and apache. To edit these files you need to do something clever like change the permissions or use something like vi. I used “sudo vi httpd.conf.”

Edit etc/apache2/httpd.conf by uncommenting the line #LoadModule php5_module libexec/apache2/libphp5.so (that means you remove the “#” from the start of the line).

Edit httpd.conf, which is in /etc/apache2. I changed the line Deny from all to Allow from all within the <Directory> tags. Then you simply restart apache with “sudo apachectl graceful.” Another way is here.


Getting MySQL to work after Leopard upgrade

I found MySQL wasn’t working after my Leopard upgrade, but there is a fix here for getting it to go. If you had it running previously then you probably don’t need that step. However, there is a fix here to make the preference pane work again, which I did need. Thanks!


Installing iPython, Numpy, Scipy, and Matplotlib on Leopard

[EDIT: This is pretty old now, it probably works if you want a whole separate install, but I’ve recently obtained some new macs and found it can be much easier. Details in this post]

So after upgrading to Leopard I found my Python plotting stuff didn’t work, so had to reinstall it. My last setup was decidedly dodgy, being something of a mix of 2.4 and 2.5, which wouldn’t work if I removed one. Very suspect.

I have a MacBook Pro, recently upgraded to Leopard. Mostly I followed these instructions, but there were some steps skipped that I had to include for my particular case. Possibly because I’m on an intel macbook and the steps were for a ppc.

[I recently noticed this page, which you might want to read first since you might not really have to do a whole new install]

First thing I needed to do was get the latest XCode (3). A 1Gb download since my X DVD was at home. I also got the latest gfortran from here (gfortran-4.2.1.dmg) and installed fftw as decribed on the scipy pages.

I started totally from scratch, removing /Library/Frameworks/Python.framework/ , MacPython from Applications, and the executable links in /usr/local/bin . I also got rid of the other stuff I’d installed in /Library/Python/2.X/site-packages .

I first got the MacPython 2.5.1 install and put that on. You get it from here, and it’s a simple click and install thing. Done. It gave me some thing about a postflight error, which apparently adds the Python.framework to my path, but it didn’t seem to matter.

Next was iPython from here. I got version 0.8.2. This install went fine. Checked by running ipython in a terminal. Most of the python things are installed by typing

sudo python setup.py install

Next was getting numpy and scipy from here. I installed numpy first no worries, and tested it with “import numpy” and then “numpy.test(1,10)” within the ipython shell. Scipy installed easily too. Like the guy I copied, I get one failure when running the test “import scipy” and “scipy.test(1,10)”. No worries.

Finally it came to matplotlib, from here. At this point I followed the steps here, and some other bits I found. There was a problem where the python I was trying to install with wouldn’t deal with a ppc/intel universal compile, and I had to use /System/Library/Frameworks/Python.framework/Versions/Current/bin/python instead of the default in the /Library framework. After finishing successfully, I had to manually copy the dateutil directory to /Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/ for some reason.

Finally I had to get wxPython from here, and do the click install.

After all that it finally works. I can’t really say I’m an expert since it took me a day to figure all that out. I think it’s worth it for how great the matplotlib interface is when it works though. Where else can you make nice plots that are draggable, zoomable, customisable so easily?

Quake style terminal

So anyone who played Quake back in the day will appreciate this… a drop down visor style terminal at the press of a key comb0! By the same people who brought you another indispensible app: quicksilver


Leopard upgrade

Being at Harvard means I can get computer software a little cheaper than normal, so I went out and picked out a copy of the latest OSX: Leopard 10.5. After holding off for a few days I popped the DVD in the good ol’ clunky sounding MacBook Pro drive, and let it do its thing…

After restarting it took something like an hour to check the DVD, and then at least that long again to do the install. I wasn’t paying attention too much. But it was long enough to cook and eat dinner, and for the Bruins to be 2-0 up against the Senators.

Successfully installed, it was time to find all the broken pieces and get them running again. Doing so was easy:

  • X11: The macsingularity.org site has a note and link to the macosforge X page, where I downloaded the X11 installer. I got 2.1.3 and it works nicely. The only trick was to remove a line setting the DISPLAY environment variable, which is not redundant in X11.
  • Growl: I didn’t have to do anything with growl, but the mail notification stops working. There is a workaround here that I haven’t gotten around to trying yet. More info in the forums.
  • .mac thingy in menu bar: Leopard has a .mac sync icon in the menu bar by default. You can get rid of it by ctrl-dragging it out of the bar.
  • Boinc: I use a few spare cpu cycles to look for alien signals from outer space. I had to reinstall boinc to continue doing so.
  • Gimp: I realised I was way out of date with my gimp installation, so got the latest copy.
  • Onyx: To keep my mac nice and tidy I use onyx to clean things up every once in a while. There’s a new version compatible with Leopard.
  • Aperture: I value my Aperture library a lot (A LOT) so don’t include it in my time machine backups. I don’t actually use time machine anyway (I do my own thing) so it’s not a problem.

Simple really. Upgraded without a missed step… but see these other posts for my issues with MySQL and php

Replacement MacBook Pro battery

So yesterday I wandered down to my local apple store (Cambridgeside Galleria in Boston) to see if I could get a replacement for my dead 11 month old battery. They have this “Genius Bar” where black belt OSX dudes give help on mac related problems. They were very busy, but I got an appointment for this morning.

So I wandered down there this morning to see what they could do. The guy fired up the system profiler and said something like “my goodness” when he saw the available charge and number of cycles. New FREE battery for Grant. I am within my 1 year warranty, and have applecare too so there were no worries. A mate of mine had his replaced the other day, with a 13 month old macbook and no applecare, so it’s worth a go…

See the mac page for a few more comments on how to avoid the problem with your new one.

The letter ‘G’

Todays photo, brought to you by the letter ‘G.’

brought to you by the letter G…

Mac ads

I haven’t made the jump to Leopard yet (waiting for some of the bugs to be ironed out…), but there’s a clever ad on the New York Times home page…


Macbook Pro battery issues

This morning my macbook pro’s battery was clearly in trouble. It had been charging overnight, and was displaying 74%. I unplugged it for a while, and it went flat in half an hour. It then wouldn’t charge, remaining at 2-4% for an hour or so.

I found this article, showing how to reset the “system management controller.” I did this, and now the battery is charging as normal. No new battery for me! (for now at least)

UPDATE: Now my battery is completely screwed. iStat Pro tells me I have about 25% health and I usually get less than half an hour of charge. My computer tends to die randomly when the charge goes below half or so, so I just leave it plugged in all the time now. A trip to my local mac shop is order when I find time…

UPDATE AGAIN: Battery replaced for free!