Experiencing extreme frustrations with the MacBook

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):

  1. What am I doing wrong? Is there a better way?
  2. How can I overwrite files when I open them in a text editor?
  3. How can I setup the mate command to open files in TextMate?
  4. How can I open the ~/.bash_login file to edit the PATH? And are there other .bash_xxxxx files I need to edit?
  5. 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?
  6. 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).

Comments

01

Chris on Fri Jan 12 at 05:01PM

1) I can’t really say there’s a better way for some of this stuff, but I’d recommend trying DarwinPorts (http://darwinports.opendarwin.org/) because it will take of some of the steps for you.

2) Certain files definitely need sudo (root) access. Is the root user enabled on the system? Run NetInfo Manager (use Spotlight to find it), click the Security menu to authenticate, and then in the Security menu again there should be a way to activate the root user account.

3) In TextMate, go to Help > Terminal Usage and create the link (in the /opt/local/bin directory perhaps). This should allow you to use the mate command.

4) Open the Terminal and type mate ~/.profile to edit environment variables, etc. that you want to have in every terminal session. Here’s a line from mine: export PATH=/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH. Note: every time you change this file, you need to reload it in any open sessions by running source ~/.profile.

5) Type which ruby to find out where the shell is finding the install of Ruby. The order of the directories in the PATH variable will determine where it will look. You may want to try installing Ruby via DarwinPorts (sudo port install ruby and to install rubygems: sudo port install rb-rubygems). Most likely the problem you are running into is that you have to set the PATH variable in your .profile, so if you don’t do that, then when you go back to a new Terminal it’s finding the old Ruby.

6) In terms of the Mac, I believe this is usually referring to loading a disk image (dmg file) which makes it appear as a drive on the computer.

Hopefully that will shed a little bit of light. Unfortunately, I haven’t installed MySQL on my computer, so I don’t know the process.

02

Ryan on Fri Jan 12 at 08:03PM

Thanks, Chris. That’s very helpful stuff. It turns out, I had two things wrong:

  1. I didn’t have the PATH set in the ~/.profile file, but I just ran the export PATH=....... So I’m guessing it was only in that terminal session, and not persistent each time I loaded the terminal.
  2. And the MySQL thing got fixed by running: sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config instead of: sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql.

One more question—do I need a SVN client or can I just use the terminal and run the commands that way?

03

Chris on Sat Jan 13 at 05:11AM

I use the svn commands in the Terminal almost all the time. Originally, I was using svnX, but found that I was more efficient just staying in the Terminal. I would still recommend installing DarwinPorts because you can use it to install lots of different utilities with it (wget, sqlite3, etc.) very easily (the port command takes care of downloading the proper version, compiling, and installing).

Have something to say?
Please rewrite the image text Are You Human? Hint: Are You Human? Formatting Tips

or

© 2009 Ryan Heath | Site Management A Ruby on Rails production.

Get in Touch