Archive | OSX / Apple RSS for this section

Compiling Ruby on OSX : Readline [Resolved]

An hour before our Daily Scrum this morning I decided to recompile ruby on my Mac (OS X 10.5.8). I did this because I was trying to install passenger for development. More on that later (maybe).

I ran into the following issue with readline while I was building ruby with the--enable-shared option.

readline.c: In function ‘filename_completion_proc_call’:
readline.c:703: error: ‘filename_completion_function’ undeclared (first use in this function)
readline.c:703: error: (Each undeclared identifier is reported only once
readline.c:703: error: for each function it appears in.)
readline.c:703: warning: assignment makes pointer from integer without a cast
readline.c: In function ‘username_completion_proc_call’:
readline.c:730: error: ‘username_completion_function’ undeclared (first use in this function)
readline.c:730: warning: assignment makes pointer from integer without a cast
{standard input}:358:non-relocatable subtraction expression, "_mReadline" minus "L00000000007$pb" 
{standard input}:358:symbol: "_mReadline" can't be undefined in a subtraction expression
{standard input}:356:non-relocatable subtraction expression, "_completion_case_fold" minus "L00000000007$pb" 
{standard input}:356:symbol: "_completion_case_fold" can't be undefined in a subtraction expression
{standard input}:342:non-relocatable subtraction expression, "_mReadline" minus "L00000000007$pb" 

After google’in and coming across some similar but different solutions

Then I found this and realized that I was most likely not using the correct readline lib.

So, the issue was related to having two readline libraries installed, one in /usr/local/lib, which was installed by port as a dependency to postgres, and the other, located in /usr/lib came with OSX.

For whatever reason ruby 1.8.6 does not like to use the port library so all I had to do to get going was specify which realine library I wanted to use.

./configure --enable-shared --enable-pthread CFLAGS=-D_XOPEN_SOURCE=1 --with-readline-dir=/usr/local

Happy compiling!


FAIL: sudo gem install mysql (Fixed)

The other day I had an issue with ruby and so I went to google to fine a fix…. I laughed when the second result was my own blog. 🙂

I figured it wouldn’t hurt to save me some time next time I run into the OS Xnightmare with the mysql gem so here is what happened and what I did to fix it.

After running “sudo gem install mysql” I got the following errors:

/usr/local/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... no
checking for mysql_query() in -lmysqlclient... no

As usual I looked into the mkmf.log found in the gem directory and saw a bunch of these:

"gcc -o conftest -I. -I/usr/local/lib/ruby/1.8/i686-darwin9.6.2 -I. -I/usr/local/include   -D_XOPEN_SOURCE=1  -fno-common -pipe -fno-common conftest.c  -L. -L/usr/local/lib -L/usr
/local/lib -L.      -lruby-static -lmysqlclient  -lpthread -ldl -lobjc  " 
ld: library not found for -lmysqlclient
collect2: ld returned 1 exit status
checked program was:
/* begin */
1: /*top*/
2: int main() { return 0; }
3: int t() { mysql_query(); return 0; }
/* end */

So here is what I did to fix it:

sudo ln -s /usr/local/mysql/include /usr/local/include/mysql
sudo ln -s /usr/local/mysql/lib /usr/local/lib/mysql

[heppy /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7 64]$ sudo gem install mysql
Building native extensions.  This could take a while...
Successfully installed mysql-2.7
1 gem installed
Installing ri documentation for mysql-2.7...


OSX Leopard upgrade – Only in the Silicon Valley

So, I like many others purchased my upgrade online prior to the release date and looked forward to the 26th of October. Since I was at work I missed the package and had to go to the FedEx place after work to get it. As I was walking in a boy and his father were just leaving the cash register and the boy had a huge smile and just as they left the FedEx guy said “now don’t stay up too late tonight.” Then I got in line and noticed a guy behind me with a shirt with the name Geek on it and wondered if he was picking up his Leopard, but I just minded my own business and didn’t ask. Long story short there were at least ten people in line now, and once I saw the size of my package and realized that everyone was picking up and walking out with the same sized package, I knew for sure that they were all there to pick up their OSX Leopard. I couldn’t help but be amused that so many people were there to pick it up. The puncher was when the FedEX guy said “I can’t wait until work is over and I get to go home and install mine.”

Now for my quick review of my first impressions of Leopard. Overall the upgrade is pretty good, but other than the Mail upgrades with TODO’s, Notes, and RSS, and maybe Time Machine, I don’t think that it was imperative that I upgrade since many of the new features were already available with third-party applications like Virtue Desktops for Spaces, Time Machine and regular backup software, etc. I did like the new “Quick Look” view in Finder, but like so many of the other upgrades and improvements they are fun, cool, neat, and sweet, but not life altering. Maybe I just haven’t played with it all yet and haven’t looked at all of the enhancements. I don’t regret the upgrade, but to all of those cash strapped people who want to upgrade because they feel like they will be left behind — take your time.

Installing RMagick on OSX

I am working on a little app (link coming soon) with a friend of mine in an effort to practice my rails and now Rmagick skills since my day job doesn’t allow me the opportunity.

One of the things that I am building is an logo generator so I need to have an image manipulator/generator of some sort. I have used ImageMagick on many projects in the past so I looked forward to spitting out the classy logos uswing Rmagick.

Like most open-souce installs on OSX and Linux there were some issues that came up along the way.

I first ran the following command on my OSX terminal but got a couple of errors.

# sudo gem install RMagick
Can't find Magick-config or GraphicsMagick-config program.

I fixed this error by installing the imagemagick-dev version as opposed to imagemagick.

Then when I tried it again I received this error:

Can't install RMagick. Can't find libMagick or one of the dependent libraries

I resolved this error by searching google and finding this thread so I toldfink (one of my osx package managers) that I wanted it to build imagemagick from source with the following command:

# fink --no-use-binary-dist install imagemagick-dev

After I rebuilt ImageMagick form source and inclused all of the dependent libraries i was able to successfully run the following command with no problems:

# sudo gem install RMagick

It worked! Yeah!

Now I will get back to the Rmagick docs. 🙂


My OSX Package Managers

I am no OSX guru, but I will way I love how I can benefit from a operating system that has popular software developed for it yet still contains the *nix like terminal with its maturity and vast offering of open source programs. I use both Fink and Port and use one or the other depending on the versions of packages they have available. If there is a bug in one package and use the other package, it works just great.


Moving from Windows to OSX is a No-Brainer

A year ago I was considering the move from Windows to Linux Desktop, but was a little bit concerned about not being able to run a few apps that I use day to day. The thought came to me… “why don’t I just go to OSX since it is unix and has all of the software that I need?”, so here I am today finally moved over to OSX. Yeah!

Last week I decided to purchase a MacBook Pro and start my move from Windows XP. I thought I would report a few of the things that I noticed during the transition.

1) Installing new software is so easy… where did all of the wizards go? 🙂

I noticed was when I downloaded the software, in many cases it was just a matter of dragging the application from the mounted package into my applications folder. I was expecting a windowesk experience where a wizard always comes up and I have to click next, next, next, yes/agree, next… you get the point, but it only happens when you install larger apps and even then it is fast and easy.

2) The hardware and software just work!

It came time for me to move my Palm Desktop stuff to OSX and setup the bluetooth sync. Now to give you some background, this process took me two days to setup on my windows xp laptop. I installed the palm desktop and turned on my treo 650 and went to the bluetooth sync settings. It quickly saw my macbook and I clicked next. Guess what? Yes, it worked. I was beside myself and wondered what I would do with all of the extra time I had expected to spend. 🙂

3) There are so many really cool apps out there.

I asked two of my good friends for suggestions for OSX since between the two of them they covered my software needs. It took me a couple of hours or so to install all of the software they recommended. It was easy and very fast.

I love my new MacBook Pro and look forward to becoming a more mature OSX user. When expressing my concerns about not having the time to learn a new OS, all of the Mac users that I new said that it would be an easy transition — they were right.