I’m going to lose my mind. This is a major deterrent for me to want a Mac. I’ve spent most of the afternoon trying to get Ruby/Rails/Mongrel/MySQL setup on this MacBook. I have too much ego to look up the little things I feel that I should know how to do.
After looking around online, I found this script from Geoffrey Grosenbach, which basically does this. I changed the script so that it would install Ruby 1.8.5 and MySQL 5.0.27 for the Intel Mac, and set the PATH (because that’s what it told me to do) by doing:
$> export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
Eventually, after realizing I needed Xcode for the C compiler, the script executed. Perfect! Wrong. The next step was to install the mysql gem, and this is what I see:
$> sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql
$> mysql.c: In function 'Init_mysql':
mysql.c:2015: error: 'ulong' undeclared (first use in this function)
...
After searching a little bit, I found out that I need to add a line to /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/mysql.c, so I do this:
$> cd /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7
$> open -e mysql.c
The file opens in TextEdit. I add the following line:
#define ulong unsigned long
Now, this is where I lose my mind. I cannot save the file. It tells me I can’t overwrite it. I thought maybe I needed to set permissions on it, so I ran a chmod 755 on the file, seemed to work fine, but still the same issue. After more searching, I found another way. Add the above line of code to the stdlib.h file in /usr/include. But I get the same result there: “Couldn’t overwrite the file.”
In desperation, I tried setting permissions on the directories and opening the file(s) by doing this:
$> sudo open -e mysql.c
I’m honestly unfamiliar with the sudo command, but I took it to mean this will gain root permissions, even though I don’t know if that’s what I need to do—like I said, I was (am) desperate. But I’m ready to close the lid and never open it again. It’s so frustrating. Anyway, assuming that would work I’m supposed to run make to recompile the source:
$> sudo make
$> sudo make install
$> sudo make clean
In conclusion, I have a few of questions (some related to this, some not):
- What am I doing wrong? Is there a better way?
- How can I overwrite files when I open them in a text editor?
- How can I setup the
mate command to open files in TextMate?
- How can I open the
~/.bash_login file to edit the PATH? And are there other .bash_xxxxx files I need to edit?
- How come after install Ruby 1.8.5 (and verifying it with
ruby -v), later on, it’s back to default install of Ruby 1.8.2?
- What does it mean to “mount” something?
I’d love to see the light one day and realize how wonderful it is to develop on a Mac, but it’s honestly not looking so good at the moment. I really do think it could be fun once I got familiar with everything, I’m just losing my desire more and more (and clearly speaking out of frustration at the moment).