Mac

Installing MySQLdb on MacOS Lion

1 min read

I ran into an issue installing the MySQLdb module.

>>> import MySQLdb
/Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg/_mysql.py:3: UserWarning: Module _mysql was already imported from /Library/Python/2.7/site-packages/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg/_mysql.pyc, but /Users/jhaddad/Downloads/MySQL-python-1.2.3 is being added to sys.path
Traceback (most recent call last):
  File "", line 1, in
  File "MySQLdb/__init__.py", line 19, in
    import _mysql
  File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 7, in
  File "build/bdist.macosx-10.7-intel/egg/_mysql.py", line 6, in __bootstrap__
ImportError: dlopen(/var/root/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
  Referenced from: /var/root/.python-eggs/MySQL_python-1.2.3-py2.7-macosx-10.7-intel.egg-tmp/_mysql.so
  Reason: image not found

I fixed it by doing the following:

mac mysql python
Read more

Api Tester now hosted on Github

1 min read

About 4 years ago I decided to write a little GUI tool for manually testing API calls. Put it on the top of my blog, people have downloaded it, and I haven’t touched it since then. Last updated timestamp was 2007.

I don’t know if anyone wants it, but it could be useful as a starting point, or to understand how Cocoa apps were written… 4 years ago… I don’t know. Whatever.

mac
Read more

'Headless Virtual Box '

1 min read

I like running VirtualBox headless on my Mac. It doesn’t show up in the Dock, and feels like it’s a remote server.

First, figure out which VMs you have on your machine.

haddad-work:~ jhaddad$ VBoxManage list vms
Oracle VM VirtualBox Command Line Management Interface Version 3.2.6
(C) 2005-2010 Oracle Corporation
All rights reserved.

"WebServer" {2c61a180-e098-4926-b09a-27e431791c88}

Then start it using VBoxHeadless

nohup VBoxHeadless -s WebServer -vrdp on  &

I’m using Cord for RDP.

mac virtual box
Read more

Running Puppet Master on Mac OS X Snow Leopard

2 min read

_As of a few hours after this post, I’ve given up trying to get Puppet Master running on Snow Leopard. There appears to be an issue with the SSL certificates generated that’s preventing puppetd from getting it’s recipes. There doesn’t appear to be any way to disable this. I have switched to a CentOS VM, which worked perfectly the first time. The Unixy underpinnings of my Mac seem to be getting less and less useful every day. _

mac puppet
Read more

Installing NumPy on MacOS X Snow Leopard

1 min read

NumPy is a requirement to work with PyTables. This is the second step in the install process, after getting HDF5 set up.

These instructions are based on the ones found on the NumPy site, but I’m summarizing things for my own use later on.

First, you’ll need to install the Fortran compiler for OSX (gFortran). Fortunately there’s a Fortran universal binary installer.

Next, get the NumPy source. You can find it on Sourceforge.

Now, build with gFortran.

fortran mac numpy
Read more

Helpful guide for setting up SSHFS on mac

1 min read

I finally got fed up enough to look into this. I’ve previously used Samba mounts, but this in theory should be better.

http://www.turingtarpit.com/2009/04/mounting-remote-filesystems-on-osx-leopard-using-sshfs-macfuse-and-macfusion/

If you’re using Snow Leopard, the drive will not be able to mount. You can get around this by deleting /Applications/Macfusion.app/Contents/PlugIns/sshfs.mfplugin/Contents/Resources/sshnodelay.so

mac sshfs
Read more

New Mac Dev Box Software Checklist

1 min read

When I get a new Mac, I go through the same steps every time. Yes I use a Mac as a dev box.

Software

Xcode Adium Launchbar iTerm - change defaults to black background. (edit bookmarks, default, background) Apache HTTP Server (source) MySQL (source) PHP (source) Eclipse PDT Omnigraffle Fluid BBEdit SubEthaEdit Git SVN Memcached

Tweaks

Remove everything from Dock.

Fix the look of the dock.

defaults write com.apple.dock no-glass -boolean YES killall Dock

/etc/bashrc tweaks

alias v=“ls -lahG” alias vi=“vim”

mac
Read more

On cocoa...

1 min read

I found this pretty amusing…

me: i’m terrible w/ cocoa i don’t particularly like objective-c it’s to verbose

**matt: **
[me putonSock:blueOne onFoot:rightFoot ignoringHangNail:YES]

cocoa mac
Read more

'OS X: Spaces + Fluid

1 min read

I’ve tried so many times to use Spaces, and I keep failing. As useful as it should be, it just never was. And I’ve finally realized why. Most of what I do is in a web browser. And spaces just wasn’t made for that. I want Gmail to always be in space 3. Facebook on 4. It just wasn’t meant for that.

I’ve recently discovered Fluid. Fluid brings creates Site Specific Browsers. This means I have an actual application that I launch called Gmail. It’s independent from everything else, doesn’t crash when Safari does (which, to be honest, is all the time). I can assign it to a space. So good.

mac spaces
Read more

Goodbye Quicksilver, Hello LaunchBar

1 min read

It’s unfortunate that I’ve reached this point, since I thought quicksilver was a really awesome piece of software. Unfortunately, it’s just gotten to be completely unstable. Beach balls became all too common. So common, that I was willing to cough up $20 for LaunchBar after only trying it out for 10 minutes.

I never was a power user of quicksilver - I did like a lot of things in theory, but I never took the time to memorize the keyboard shortcuts. Since Launchbar is a commercial product, hopefully it hangs around a lot longer. That and I paid for it.

launchbar mac quicksilver
Read more

Western Digital Drive with Leopard - File system formatter failed.

1 min read

I just bought a 1TB Western Digital drive. I am stoked.

However, I tried to format the drive on my Mac (Leopard) and got the error “File system formatter failed” when I tried to format the disk as MacOS Extended (Journaled). Not cool.

I found this forum thread which suggested using multiple partitions to solve the problem. When I was trying this, I went into options and changed the partition scheme from Master Boot Record to GUID partition table. It formatted fine.

mac tips
Read more

External Libraries in XCode

2 min read

  • c++
  • mysql
  • xcode

I need to compile something and use the MySQL C++ library. I have mysql and mysql++ already compiled, I won’t go over how to do that now.

I added the following code to the top of my source:

#include <mysql++.h>

I got an error

/Users/jhaddad/dev/search_engine/main.cpp:4:21: error: mysql++.h: No such file or directory

Not cool.

How to fix:

In XCode, open up the project settings (under the project menu). Click the build tab. Go down to search paths, and you can change your Header search paths to the correct locations where you installed whatever you’re looking for. In this case, mine was /usr/local/includes and /usr/local/mysql/

c++ mac mysql
Read more

Tool for Testing API's on a Mac

1 min read

  • api testing
  • mac

I wasn’t able to find anything that I liked. I basically wanted a front end for curl with bookmarks.

Check out my cleverly named Api Tester. No docs yet, but I hope it’s self explanatory. Click the plus on the bottom left to add a bookmark. It’s freeware. Or, just download.

mac
Read more

Regex Coach Mac Substitute

1 min read

For a while I had to use a Windows box for my development. Fortunately, I was able to make a good case for my company to switch me to a MacBook Pro.

One of the tools that took me a while to track down was a regex testing app. On Windows, I was a big fan of Regex Coach, which is a great app.

I was happy to find QuRegExmm. It’s not nearly as feature rich as Regex coach, but it seems to be good enough for me, since I really only want to test regular expressions, not really do anything else with it.

mac regex
Read more

Compiling Imagemagick on MacOS X - Not finding libjpeg

1 min read

I ran into an issue trying to get Imagemagick (convert) working on OSX last night. I had compiled libjpeg and installed it, but when I would compile convert, it would not have jpeg support.

I found this post on dzone, which I followed and was able to use libjpeg just fine.

tar zxvf jpegsrc.v6b.tar.gz cd jpeg-6b cp /usr/share/libtool/config.sub . cp /usr/share/libtool/config.guess . ./configure --enable-shared --enable-static make sudo make install sudo ranlib /usr/local/lib/libjpeg.a

mac tips
Read more