Posts Tagged ‘solution’

Snow Leopard, 64bits, Ruby and MySQL

I recently started again wanting to play a little bit with the so acclaimed Ruby on Rails framework. Being on a Mac, I had not much to do to start working, with Ruby & RoR already installed with my Snow Leopard default OS X install (maybe because I’ve already installed the XCode Developer package, as well as the iPhone’s one… maybe you should check). So I was playing with my Ruby on Rails’ guide and I had already started building a project, having it displayed in my browser, so I knew the core of the install was up and ready.

Next step was to connect with MySQL. It proved not to be so simple as expected… Running rake db:migrate to check Ruby was well connected with MySQL lead to the following errors (both errors came repeatedly during my way to the solution, given below…):

  • uninitialized constant MysqlCompat::MysqlRes
  • dyld: lazy symbol binding failed: Symbol not found: _mysql_init
    Referenced from: /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/

After some research and tests following different articles on the net, I finally got with a working solution (however please notice that it applies to an Intel Mac with 64bits processor under Snow Leopard):

  • Install the latest x86_64 MySQL release (currently the mysql-5.1.53-osx10.6-x86_64). Several articles on the net will tell you the problems are due to the 64 bits version, you should install the 32 bits one, and so on. In my case, I tried both and it worked with the 64 bits one.
  • Make it work! Check the install documentation, connect with mysql, start the server… to be sure everything is working. A good thing would be to be able to connect to it with phpMyAdmin for example (which I did).
  • If you had already install the mysql gem (which you should have to need this page because you must have faced the previously mentioned issues…), uninstall it with sudo gem uninstall mysql.
  • The trick is then to reinstall it with the following command line: sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config which ensures the gem is installed for the 64bits architecture, matching the MySQL one.

Then, you should not face the previous problem any more, maybe some access denials due to misconfiguration in your RoR’s project “database.yml” file or your MySQL configuration. But the Ruby/MySQL connection should be OK!

Categories: Mac OS X Tips Tags: , , , , ,

Fix Apple aluminium ultraflat keyboard

I have had a little issue with my Apple aluminium ultraflat keyboard: I used some cleaning foam to make it shine, and there must have been more liquid than foam on my tissue… and some must have gone to the ‘L’ key…

I faced the following issue after plugging my keyboard back: the ‘L’ key was acting like it was pushed, so as soon as the keyboard was plugged it started typing llllllllllllllllllllllllllllllll… and so on. Typing another key stopped it, but then no way to make the ‘L’ key work anymore.

After having tried to blow on the unmounted key, unmount the mechanism, have some water on it, nothing made it, it was still not working. Finally, I ended up sinking the whole keyboard in water, leaving it there for approx. 2 hours, hoping the product would be gone. After 1 week drying quietly not far from the heater, it was working again as before!

Since during my first repairing trial I kind of broke some part of the mechanism, I had to exchange two keys (my broken ‘L’ with the never-used-number-pad-lock-key). To prevent this, please find a video (sorry voice and subtitles are in French) explaining how to unmount the key and the mechanism without broking it.

Make Wireshark work on OS X

You just have to make the BPF file of libcap readable with the following command (in your terminal):
sudo chown {your account name} /dev/bpf*

Original tip source

Categories: Mac OS X Tips Tags: , , ,

Your CoreData app is crashing you don’t know why? Check your properties’ names!

In my case, I was using a property named “description”. Causes the apps to crash without displaying anything to help, so beware of your properties’ names!

AFP (Apple File sharing Protocol) issues when sharing between same user

Here was my problem: I have 2 Macs, with one user account on each of them. Both user accounts share the same username (quite easier, isn’t it?). I use Mac B to connect to Mac A with my user’s login/password, I go through my files on Mac A, which I can read, but impossible to edit or create anything! Seems I’ve no write rights! Same problem in the other way! But no problem when connecting with Mac B to another user account on Mac A!

NB: the considered user accounts have administrator rights on both Mac, and all files have read/write permissions for this user.While I don’t think it is of any importance, I performed a migration of the user account from Mac A to Mac B with the “Migration Assistant” tool provided in MacOS X. My both Macs are under Snow Leopard 10.6.3, but this seems to be a common issues between numerous versions of OS X.

Googling a little a good hour, I found the explanation, and a solution. The reason is that, while the user accounts on Mac A and Mac B share the same username, they do not share the same UID (Unique ID, a number used by the system to identify a user account – it is generally hidden to the user, replaced by the username). This is due to the fact on Mac A, I created another user account before this one, so it took the 502 UID. On Mac B however, it was the first one so it took the 501…

Don’t ask me why, but this is the reason of all these write permissions problem, so now, how shall we address this issue? The solution is quite technical, and may be risky if you do not master what you’re doing, so please be prudent, and remember I shall not be taken responsible of any consequence of your acts! If advise you to do this only if you already know what the Terminal is, and how to use it. If not, ask a friend!

To fix this issue, you will indeed need to change your user’s UID manually. This requires terminal manipulation…

  1. First, you should check you really have the described problem (UID inconsistency). For this, you can execute the following command on both Macs: dscl . -read /Users/replace-with-your-username UniqueID. It should give you an answer of this form: UniqueID: 502. If answers are not the same for both Macs, you have this problem, and this is probably the cause of your file sharing issues.
  2. You now have to change your UID on one of the Macs to match with the one on the other. Be sure not to change to a UID already used by another user account in case you have multiple users on the Mac you wish to make the change on. For this, use the following command: sudo dscl . -change /Users/replace-with-your-username UniqueID replace-with-originalUID replace-with-targetUID. This will change from originalUID to targetUID.
  3. Finally, you need to update your whole user’s folder permissions to match your new UID. Since the terminal you’re logged in do not know you anymore (you changed your UID, remember?), you should open a new one (asked a password in my case), and use the following command to update your UID for all your files: sudo chown -R replace-with-targetUID /Users/romain/.
  4. Finally give your Mac a restart, it will help him not loosing track of you!

If you did this, I hope it worked for you as it did for me! You can give a eye to the following pages which I used to identify the issue and solution, if you want to be sure before doing it:

Changing iPhone app name dynamically? Huh, no…

[Edited] That’s possible impossible. (In the simulator, it is. In the real life, the iPhone must be protecting its app bundle’s files. I think I wasn’t patient enough to read the doc on security. And it’s a logical security measure…)

So you can can’t let the user choose the display name of your application (the one shown in his iPhone’s Springboard).

Not more possible for the icon, alas, I already tested some time ago. I suspect the icon to be merged with the gloss and frame layers at installation time, so it won’t reload afterwards… while the bundle’s name will! But since you can’t change it… But if someone does make this happen (out of jailbreaked iPhones I mean), I’d be happy to know!

See you (with things that work)!

Good vibes on keyboard for Mac virtualizing Linux

After advancing blindfolded for a while, I finally put my hand on the good configuration for getting Ubuntu working nicely with my little Mac’s keyboard!

Needing to do some terminal’s configuration, I can hardly use the virtualized system without being able to type these little chars: |, \, {, }, [, ] and such bizarre things…

Just cutting to the end: here is what you want to see on your Ubuntu’s keyboard settings (may not be exactly the same in English, my Ubuntu is in French and I’m making the translation, sorry in advance):

  • Apple for keyboard model,
  • France-Apple Macintosh” for keymap (France is for me naturally, you’re supposed to get your own country there),
  • Edit keymap options:
    • key(s) changing the setting: I selected “Alt+Shift”,
    • key(s) selecting the 3rd level: I chose “Any Alt key”.

And now I’m very happy since I feel almost like on Mac OS X while typing on my virtualized Ubuntu machine!

%d bloggers like this: