Archive for the ‘Mac OS X’ Category


Simple multiuser chat for POSIX systems

Wednesday, November 24th, 2010

Here’s a little multiuser chat server written for various POSIX-compatible operating systems. Written and tested on Mac OS X 10.6, but it should work on your favorite Linux, too.

Placed in public domain, use it for whatever you want (since it’s so simple). 177 lines of pure C powah, dood.

Code follows after the break.
(more…)

Some tips on building fuse-python on Mac OS X

Monday, November 15th, 2010

I can’t document everything from scratch since I don’t have a machine that’s “virgin” enough for me to document that. This machine has been touched by Fink, MacPorts, Rudix, and several hand-build packages; I’m not sure if MacFUSE installs the necessary stuff for pkg-config.

But, let’s presume you:
a) installed macfuse,
b) fetched pkg-config source code from freedesktop.org (I took 0.25)
c) built it and installed it (./configure, make, sudo make install)
d) switched to pristine Python 2.6 that Apple ships with Snow Leopard.

I’m also obviously using Snow Leopard, so no guarantees about other OS X versions.

Ok, and now come the tips…
(more…)

Why my Mac is Google-free: Google Software Update

Tuesday, October 19th, 2010

Apart from using Google’s web apps, I have cleaned my Mac of Google’s apps. Chrome is great — I’d love to have it. I don’t need Picasa. Google Earth would be cool to have, but just that: cool. I don’t do 3D, and I can’t add buildings to Croatia, so SketchUp is useless. Google Video and Voice Chat would be great to have, but it’s still somewhat unstable, and besides, I don’t have anyone to do video and voice with on a regular basis. And Google Gears was never updated for 64-bit and Snow Leopard so I could use Offline Gmail.

But all this is not a real reason. I love to have a lot of junk apps, just in case I’ll run them every once in a while. The real reason is the hyper annoying, unconfigurable, trojan-like piece of shit called Google Software Update. In its current incarnation, it still does not announce its presence to the tech un-savvy Mac user. It does not provide any configuration whatsoever. And it silently accesses my Internet connection.

Yes, that means that I’m doing a hyper important update of a web site over piss-poor WLAN (I have a few locations where the connection is very, very sluggish and unreliable), or even if I’m doing it over bandwidth-capped EDGE connection over my phone, Google Software Update will think it prudent to kick in and silently fetch updates.

I never, ever expected such disregard for user’s needs from Google. Just because this is a Mac, they believe everyone is hyper-rich, always on broadband and never on slow net, and never, ever unable to afford random software updates grabbed over capped EDGE.

Guess again, Google! I don’t want you to fetch updates randomly, and I don’t want to be alerted every few hours by the firewall that you’re trying to fetch an update. At the same time, if I blocked just your update program, I have no idea what else I’ll break.

A total lack of transparency when installing Software Update makes me call it a trojan: it doesn’t transparently present itself when installing, it sits silently in background invisible during normal use, it performs potentially malicious tasks.

Oh, and you can’t block its installation. Even if it’s a separate component in the installer (Google Voice and Video Plugin), it’s marked as required. Required my ass — let me keep the software out-of-date, and get off my lawn!

Hence, I’ll give up on all the “benefits” of various Google apps on Mac, and call it a day. And I’ll post this rant, just on the off chance it’s read by someone on Google’s Mac team. Or on the off chance that it gets picked up by some statistics bot they run.

Single Xcode project for iOS and Mac OS X

Thursday, September 16th, 2010

In Xcode 3.2.4, it’s trivial to create same project for iOS and Mac OS X. Just add a new target into your existing project; if your project is for OS X, then create a new Cocoa Touch Application target. If your project is for iPhone, obviously, craete a new Cocoa Application target. Then do a Get Info on your new target, and choose the appropriate Base SDK. For simplicity, let’s presume you’re adding an OS X target to an iPhone project.

However, after doing this, you’ll quite probably find that despite the choice of Base SDK in your target (you used Get Info on it, didn’t you?), Xcode has locked the target SDK onto whatever your project originally used. That is, now you’ll find it locked onto iPhone, despite switching to the OS X target using the Overview dropdown (in the top left of your Xcode project).

So how do you actually switched the now-locked SDK? Quite simple. Hold the option key while clicking in the Overview box. Instead of only two-entries device list (if you have an iPhone target selected), and then Active Configuration, Active Target, Active Executable and Active Architecture, by holding the option key while clicking on Overview you’ll also find the Active SDKs list. By switching it to the appropriate OS, you’ll be able to compile the application.

Of course, now comes the hard part: actually porting the code to the new platform.
E49PEQSG669E

After MySQL upgrade on OS X, all tables are missing

Wednesday, September 15th, 2010

When upgrading MySQL on OS X (anno domini 2010),  I learned the hard way that the “data” folder containing your databases and tables does not get moved. Look into /usr/local; you will probably have the old mysql-* folder there containing just the “data” folder. /usr/local/mysql is a symlink to the current MySQL installation, so move its data folder elsewhere, and put the old one in there.

PHP on Mac no longer able to connect to MySQL

Tuesday, September 14th, 2010

It’s been a while since I did web development on my Mac, and MySQL ceased to work. Could be related to that one time that I accidentally removed a bunch of dot-files from my home directory, could be related to MySQL upgrade. In any case, it no longer worked.
What I figured out was that the /var/mysql/mysql.sock UNIX domain socket was no longer generated. The /var/mysql folder was missing. When just creating it and assigning it to user _mysql (chown _mysql /var/mysql) did not help, I knew something was wrong with configuration.

MySQL tries to read configuration from /etc/my.cnf. To get its UNIX domain socket where PHP expects it, this needs to be contained in this configuration file:

[client]
port = 3306
socket = /var/mysql/mysql.sock


[mysqld]
port = 3306
basedir = /usr/local/mysql/
socket = /var/mysql/mysql.sock
; datadir = /servers/raiddrive/databases/

Please read the manual for details, and this is not administration advice; I’m not sure if this opens security holes, but I only use MySQL for development purposes. (Because you should know better than letting programmers near mission critical production servers.)