Archive forDecember, 2008

bash: /bin/rm: Argument list too long

Today, I needed to empty a folder on my Linux server that containted a lot of files. The files where maybe 2kb, but all the files together contained over 400Mb.

So I used rm * to remove them, but it threw me a nice error: bash: /bin/rm: Argument list too long . Looks like rm has its limits :)

Use ‘find’ to pipe all the matching files to ‘rm’, one at a time:

find . -name '*' | xargs rm

And I’m a happy camper again.

Comments

Mac Leopard, ROR 2.2 and MySQL

Finally, I found a nice solution for the RoR 2.2 MySQL problem. The initial problem was that the MySQL library isn’t bundled with RoR anymore, and you need to install it as a gem. No big deal at first, but we Leopard users are “plagued” with the fact that Apple has somewhat of an exotic installation method of web programming.

The stock MySQL and Apache are both 64bit, but the Ruby interpreter is 32 bit. That’s why you can’t use the 32 or 64 bit MySQL library gem. I found a lot of “idea’s” on the net, but none of them helped out, or I didn’t think they where good enough.

One of them was to run a second MySQL instance on 32bit. A lot of users solved  that way but I found it just stupid running 2 MySQL instances. So then it struck me, why not recompiling the stock MySQL as a universal build that supports both 32 and 64 bit?

So I did. I downloaded the source from the MySQL website and compiled it like this:

MACOSX_DEPLOYMENT_TARGET=10.5 \
CFLAGS='-O3 -fno-common -arch i386 -arch x86_64' \
LDFLAGS='-O3 -arch i386 -arch x86_64' \
CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64' \
./configure \
'--disable-dependency-tracking' \
'--prefix=/usr/local/mysql' \
'--localstatedir=/usr/local/mysql/data' \
'--libexecdir=/usr/local/mysql/bin' \
'--with-comment=MySQL Community Server (GPL)' \
'--enable-thread-safe-client' \
'--enable-local-infile' \
'--enable-shared' \
'--with-zlib-dir=bundled' \
'--with-big-tables' \
--with-readline \
'--without-docs' \
'--with-plugins=myisam,innobase'

And my problem was solved. I had one MySQL instance running, and I finally could use RoR 2.2.

Now the only problem remaining is getting PHP to run properly.

Comments

Mac, though love

I recently made the switch to mac. I just love working with it. But I’m experiencing some downsides to it. This is probably due to lack of knowledge about Mac.

Like most of you know, I’m in the web development business. So I need PHP and Ruby on Rails.

I was happy to notice that PHP en RoR where installed by default on Leopard. But then I needed MySQL PDO. Hmm, the default PHP installation doesn’t support MySQL PDO. So I need to recompile. So I downloaded the PHP source and tried to recompile it with almost the same parameters I found of my previous installation. But still no go. I just gave up at the moment.

Then next thing happend. RoR 2.2 came out. So I wanted to upgrade. I upgrade an old experimental app and tried to run it. Oops, looks like RoR doesn’t ship anymore with mysql library. After a quick google, I noticed I had to install the mysql 2.7 gem.

Ok, that’s easy. Tried to install it, but ran into errors. So after some more googling I saw that other mac users ran into the same problem and various solutions where found. But, none of them worked for me. Well, I didn’t tried them all. Some of the solutions mentioned installing both 64 and 32 bit version of MySQL. Well, I just like to run a clean system and not messing with diffrent installations.

I googled a lot lately but still didn’t found a solution for both of my problems. So if any of you readers might have found a solution to help me out, please do share.

Comments