Archive for the ‘Apple’ Category

Apple Wireless Keyboard

I’m not a person who likes writing about his new toys, but I couldn’t refrain from writing this post, so excuse me in advance if I sound like the proverbial child who got a new toy.

Yesterday I bought a new Apple Wireless Keyboard and I can say without a doubt that this is the best keyboard I ever owned (and I owned a lot of keyboards, even one of the giant IBM clicky ones.

When evaluating whether or not the €79,00 where a fair price I considered the following selling points:

  • stunning design, and for me this is really important
  • small size, it allows me to type faster and unclutters my desktop
  • wireless, so I can put my laptop closed somewhere on the desktop and still work with the keyboard

They were enough for me and still I missed the most important point: the feel. Typing on this little baby is easy because the keys offer just enough resistance to the touch that you know what you’re doing and yet your fingers don’t strain too much.

I totally suggest to anyone even remotely interested in buying one to rush to the nearest reseller. A+

For the first time ever Apple failed me. A PHP horror story on mac os x.

Earlier today I was on the verge of smashing my macbook pro keyboard. I lost one whole day trying to make mssql support work on php5.

Apple ships a working php5, but obviously without any support for mssql. So I had to rebuild php from scratch.

I battle for 2 hours trying to compile freetds, then I discovered the latest version of freetds doesn’t work with php5.

When I finally compiled freetds I discovered the infamous iconv bug that doesn’t allow php to compile on mac os x with iconv support. I disabled iconv, and it compiled.

I was not finished though: apple shipped apache doesn’t want any recompiled PHP, so I had to recompile apache too.

When I thought it was all ok I discovered that symfony needs iconv so I threw all away and installed Macports (now I have macports and fink), and am trying to compile php5.

Wish me good luck.

10 things I like about Mac OS X 10.5 Leopard

I’ve been playing with Leopard since day 1, and I’ve come to love some features (and loathe others, but that’s stuff for another article). Here’s the list, in no special order:

  1. Quickview – astonishingly useful, and fast. I don’t know how I’ve managed to go this far without it :)
  2. The new search feature in Safari – it mimicks what Firefox has been doing for a long time, but the yellow popuppy highlighting sold me to it.
  3. The new iChat – if Mac OS X had a wider audience, this would be the most used program in the world. I already figure hordes of teenagers sharing their desktops and slideshows. I also envision script kiddies taking control of your desktop :)
  4. Garbage collection in Objective C 2.0 – ‘nuff said.
  5. Rubygems shipped by default – the first thing I did after installing Leopard was: sudo gem install rails—include-dependencies
  6. The new finder – I wasn’t expecting big improvements here, but it is much snappier now, and the new search feature are blazing fast, and, believe it or not, I quite like coverflow view.
  7. The way folders behave in the dock – I put my dock on the bottom just to have springing files out of folders.
  8. Webclips – suddenly the dashboard has become a much more used feature.
  9. The new window chrome (and most of all the improved shadows on the foreground window) – modern looks for modern operating systems :)
  10. Spaces – now I feel like I’m using a Unix environment :)

Sudoless Rails Stack on OSX

More and more of my developer friends are switching to OSX as time goes by, and they keep asking me for directions on the best setup for rails development: how to install ruby, how to install the missing libraries, and so on.

My professional development life started on a PB Titanium running OSX 10.2, and continued through a PB Aluminium and a Macbook Pro. Each time I changed laptop I also reinstalled everything again, and each time I tried to come up with a better setup.

Now I’ve finally found a setup I’m comfortable with, and it has the following advantages:

  • Sudoless: everything runs from my user directory
  • Non-system-tampering: doesn’t touch files in the original osx installation
  • Crash-proof-easy-reinstall: you can just delete everything and reinstall without fear of rendering your system unstable
  • Fink based: uses everything it can use from the fink repositories

Now that I’ve sold you on my setup :) it’s time to explain how to implement it.

Step one: XCode and Developer Tools

If you don’t have XCode already installed you can install it from the disks you got with your Mac or, better, download the newest version from Apple Developer Connection. Once you got it installed you can proceed to the next step.

Step two: Fink

Go to the Fink Download Page, and get the package that works best on your Mac (intel or powerpc). Follow the installation instructions and install the base fink system. After you’ve done that add these lines to your /.profile

# Dev Enviroment
 
LDFLAGS=-L/sw/lib
export LDFLAGS
 
CPPFLAGS='-I/Users/your_username/unix/include -I/sw/include'
export CPPFLAGS

_/Users/your_username/unix/include_ doesn’t exist yet, but we’ll create it when installing ruby.

Step three: Ruby from Sources

This is the first tricky part. Before OSX 10.4.6 the Ruby version shipped by Apple didn’t work with rails, so you were on your own. Now it works, but I prefer to have ruby in my home directory so I can mess with the sources and with the gem files and upgrade painlessly. So download the latest ruby sources and unpack them wherever you wish (I like /src).

Now you’re ready to go. First make sure you have readline and readline5-shlibs installed via fink so you can have a comfortable irb environment:

user$ fink install readline readline5-shlibs

After that it’s time for ruby:

user$ cd <sub>/src/ruby-1.8.6
user$ ./configure <del>-prefix=/Users/your_username/unix
user$ make && make install

The whole magic (and it’s not a big magic btw) is in -prefix. Installing ruby will create the /Users/your_username/unix path. Now it’ time to add the unix dir to $PATH. Edit /profile once again and add these lines:

PATH=/Users/your_username/unix/bin:/usr/local/mysql/bin:/usr/local/sbin:$PATH
export PATH

Step four: MySQL

Quite simple with the packages from mysql.com.

Step five: Last but not least, rubygems

Fetch the gem package from RubyForge and install it:

user$ cd src/unpacked-rubygems-directory
user$ ruby setup.rb

Step six: This is the real last step :) – Rails and a little hack

Now you’re free to install rails (and friends) using

user$ gem install rails --include-dependencies
user$ gem install mysql-ruby
user$ gem install capistrano --include-dependencies
user$ gem install mongrel --include-dependencies

The small hack I was talking about is a symlink:

user$ sudo mv /usr/bin/ruby /usr/bin/ruby-apple
user$ sudo ln -s /Users/your_username/unix/bin/ruby /usr/bin/ruby

This way applications that insist on using /usr/bin/ruby (TextMate’s RubyMate for example) will work fine.

Have fun with your self-made rails stack :)

Status update: the Mac Migration Assistant

This is an update to Platform Switching.

I finally decided to run the Mac Migration Assistant, that worked so well in my switch from the Powerbook Titanium to the Powerbook Aluminium, and I soon entered a world of hurt, where the Macbook Pro was slow and crashy. I guess this is the price to pay if you like the unix part of OS X as much as the Mac part and keep compiling lots of stuff that doesn’t play nice with a new architecture :(

Tomorrow I will try to move manually the last three years of my life from IBM silicon to Intel one. Cross your fingers, I know I will cross mine.

Platform switching

As you probably know I recently bought a Macbook Pro to replace my trusty Powerbook G4, friend of many adventures in the lands of programming, and you will be happy to discover I’m still writing posts on the old friend.

The reason is simple, I still couldn’t find the time to move all of my data from the PB to the MBP, and I’m not sure I will be able to do it as soon as I would like to.

Nowaday people stock so many data on their hard drives, personal and work related, that migrating is a PITA. I could use the mac migration assistant, but I would like to reorganize everything (especially my fink layout). I also fear that many of my applications won’t work well on the new intel platform.

I’ll probably try the migration assistant and see if it allows partial migrations (maybe just music, that would be ok).

I’m open to any suggestion so feel free to comment, and cross your fingers for me :)