File Comparison on OS X


I recently ran into a version control problem with git. Well, it wasn’t actually a git problem, but rather a version control management problem. One of the projects that I have been working on has multiple developers working various aspects of a web application. The client recently told me that during a recent merge, git could not handle the number of changes. The reason was that many developers were making changes to the same file(s) (relevant to the scope of their project) and the client waited too long to try to merge.

So I was given the latest file(s) and I had to manually merge my project. I was dumbfounded. I had created JQuery plugins for the project and these were not difficult to insert into the file(s). But I also made a lot of UI changes to the main file and made numerous changes/additions to the CSS file.

After eyeballing each line of code of two files for about 1/2 hour, I realized that there must be a better way. So I googled: ‘File Comparison OS X’ and was surprised to find that I already had a utility installed ( Apparently, the utility was bundled with XCode. Who Knew?

So I opened the FileMerge app (Macintosh HD/Developer/Applications/, selected the two files and began to compare the differences. I didn’t want to merge the two files because I did not know how the changes would affect another developer’s code. It took me a while to manually make the changes to the master file(s), but at least I did not have to try to find where the differences were.

Checkout My New Site - T-shirts For Geeks

Installing git on Mac OS X


I’m starting a new project where the source code is hosted on github so I had to install git on my Mac OS X. Git is an open source, distributed version control system. To install it on my Mac, I downloaded the installer package from google code (also available via MacPorts). After installing the package, I had to configure it to work with github.

Open the Terminal application (Applications->Utilities->Terminal).


   git config --global "your name here"
   git config --global your-email-address-here

   git config --global github.user your-github-user-here
   git config --global github.token your-github-api-token-here
   git config --global core.autocrlf true

If you receive the error:
git: Command not found

You will have to add the git directory to your PATH variables:
echo 'export PATH=/usr/local/git/bin:$PATH' >> ~/.profile

Restart Terminal and then enter:
echo $PATH

You should see that the git directory was appended to the PATH.

If you are using github, ‘github.user’ and ‘github.token’ can be obtained by clicking on your account link and then clicking on “Global Git Config”.

In order to use github, you will also need to create an ssh key:

ssh-keygen -C "your name or email address" -t rsa

To copy your public key to the clipboard:

cat | pbcopy

You can then paste it into the appropriate place on githubs site.

Note: id_rsa is the default name of your public key file. If you gave it a different name, then obviously you would ‘cat’ that name. Enjoy.

Checkout My New Site - T-shirts For Geeks

Mac OS X: Configuring PHP With GD Support

mac, PHP

A few days ago, I was testing a PHP class I created that uploads images and creates thumbnails. I ran into an error when I called imagecreatefromjpeg. phpInfo() revealed that the GD Library was not installed on my Mac G5. All the sites I visited said that I would have to recompile PHP with GD support enabled. I considered working on my PC rather than recompiling PHP, but my Mac has become my primary development box, so I knew that I would need the GD Library for future projects.

Initially, I considered a new entropy PHP package. I used the entropy version a few years ago, but I ran into problems after I installed Leopard. I was fairly confident that entropy would now “play nice” with Leopard, but I wasn’t sure what it would do to my existing MySQL database.

I then considered using MacPorts to install PHP, but decided against it, because I wanted to use my existing infrastructure, not a re-installation of everything (Apache, PHP, and MySQL). If you haven’t yet started any development on your Mac, then I recommend that you use the MacPorts package. I found great instructions here.

So I made the decision to just recompile PHP with GD Support. After a few hours, I began to think that this was not a good decision. I was following the step-by-step instructions that I found here.

First I had to download and install a new version of Xcode because during one of the steps, I received the error, “C compiler cannot create executables”. Although Xcode was already installed on my Mac, it was an older version.

I then received an error when I tried to compile the GD Library (under the section: Download and Compile GD Graphics Library extension). The error was due to the t1lib not being installed. I recommend that you do a search for the t1lib after you install Xcode. If it is not present, you can go here for download/installation instructions.

One of the last steps involves confirming that PHP is loading the extension.

/usr/bin/php -i|grep -i gd

I received the error:
PHP Warning:  PHP Startup:
Unable to load dynamic library '/usr/lib/php/extensions/no-debug-non-zts-20060613/'
- (null) in Unknown on line 0

I simply copied the file from /SourceCache/php-5.2.8/ext/gd/ to /usr/lib/php/extensions/no-debug-non-zts-20060613/. I then received the confirmation:
GD Support => enabled
GD Version => bundled (2.0.34 compatible)

Additional Notes

1. Under the section, “Download and compile the GD graphics library extension”, the step refers to php 5.2.6. I changed it to php 5.2.8. Actually, I opened my browser and navigated to: I then selected the version of Mac OS X that I am using (10.5.7). I then scrolled down the list and selected apache_mod_php-44.2 and found php-5.2.8.tar.bz2. So my curl statement was:

curl -O

2. A few of the steps require you to type:
make install

You really have to type:
sudo make install

or you will receive an error. Enter your password as required.

While recompiling PHP with GD support is not for the faint of heart, it can be done. Now I can get back to work.

Checkout My New Site - T-shirts For Geeks