Falling Leaves: the Ardes blog

Archives filed under "rails"

Upgrading Rails & RVM to Mountain Lion

Ray Drainville

Like a lot of other designers & developers, I run Mac OS X & Rails—with all the dependencies that implies. In the past, I’ve been burned by OS X upgrade incompatibilities (upgrading to 10.7 was particularly painful in fact), so now I’m not as keen to upgrade to the latest & greatest as soon as it comes out.

Which brings me to 10.8, or “Mountain Lion”. I installed this on my laptop & it throughly munged the system. What’s worse, with the move & redesign, I had little time to fix it: so it remained seriously broken until about a month or two ago. This article helped the situation greatly.

However, when I finally got around to installing Mountain Lion on the laptop, using the notes above, of course the damned thing failed, but in a new and interesting(?) way. I had upgraded the system, reinstalled XCode & its command-line tools, and went to install rvm:

rvm reinstall 1.8.7 --without-tcl --without-tk

But I received the error:

ERROR: The autodetected CC(/usr/bin/gcc-4.2) is LLVM based, it is not yet fully supported by ruby and gems, please read `rvm requirements`, and set CC=/path/to/gcc .

So I looked at “rvm requirements”. It suggested I run rvm install 1.8.7, but this caused the same error message. Rooting around, I saw mention of “rvm notes”, which suggested that I run rvm get head && rvm reinstall 1.8.7. That did it!

After that I went into every local copy of Rails apps to trigger acknowledgement of the new rvm setup, and to re-trigger bundling in order to sort out all local gems. All sorted!

I also deal with a few PHP apps. It turns out that the httpd.conf files no longer enable PHP, and that you need to do so. Find the httpd.conf file in /etc/apache2/ & uncomment LoadModule php5_module libexec/apache2/libphp5.so (line 116 in my version of the conf). In addition, scroll down to configure the features for /Library/WebServer/Documents & edit for the following (line 209):

  
  <Directory />
      Options FollowSymLinks
      AllowOverride None
      Order deny,allow
      Deny from all
  </Directory>

Finally, under DirectoryIndex, ensure you add index.php (line 231), so that php files will be served. Restart Apache (sudo apachectl restart) Sorted! Many thanks to this article which helped with the PHP side of things.

Fixing Local MySQL Problems

Ray Drainville

Wow! It’s been quiet here. That’s for a lot of reasons, but partly because a) I’ve been getting over a long-term illness that had really had an effect on my work (which is now gone, thankfully) and b) my Mac suffered a nasty failure. It experienced weird symptoms, which were fixed when the graphics card & RAM riser boards were replaced. Good thing I got AppleCare for the machine.

In any event, while the machine was in the process of breaking, I realised that my local development databases weren’t backed up. Why? Because Apple’s Time Machine would want to back up hulking single-file monstrosities every time you modified it slightly. In my haste (and panic), I made an imperfect backup. When the databases were restored onto the machine, they wouldn’t work. I could see that they were there, the databases were listed, but attempts to access them inevitably resulted in failure.

It turns out to have been a permissions issue (Errno 13 in MySQLspeak: I now know that gzipped tarballs won’t preserve permissions). It took some hunting to get to the root of the problem, but if anyone else experiences this problem, the answer is that the MySQL data directory is likely to be owned by root, when it needs to be owned by MySQL. In my example, I’m assuming that the data directory is the one specified in a MacPorts installation:

  
    sudo chown -R mysql:mysql /opt/local/var/db/mysql5
  

Restart your MySQL server, and everything should work!

Separated At Birth?

Ray Drainville

Special developer pop-culture 80’s throwback edition!

You have no idea how much I had to fucking suffer to get the right frame.