Installing MySQL on Mac OS X

What follows are instructions for building and installing MySQL 5 on Mac OS X. These instructions should work perfectly on both Tiger and Leopard.

If you’re a pro at this type of thing already, if you’re impatient, or just feeling lucky, you can download the basic install steps as a shell script and give that a go. Just make sure you’ve installed Xcode and set your path correctly (if that doesn’t make sense, you should keep reading).

Why You Might Want to Build MySQL Yourself

So why would you want to compile your own version of MySQL when the MySQL team releases a Mac OS X build that you can download and install in one step? There are a few reasons:

  1. As of today (2007-11-09) there isn’t a MySQL package-installer for Leopard, and the Tiger one has a few issues
  2. You’ll have a stand-alone, easy-to-update version of MySQL that you control and understand
  3. When a new version of MySQL comes out, you won’t have to wait for the MySQL team to release a package for Mac OS X (or for your version of Mac OS X) ... just download the latest source and follow the steps – they never change
  4. You can easily uninstall MySQL yourself at any time
  5. Compiling software yourself lets you learn how Mac OS X and the software you use really work behind the scenes

But … there are some downsides, too:

  1. You won’t get a Preference Pane to start/stop MySQL (unless Mantorg agrees to build us one. Idea: email him and tell him you want him to)
  2. It takes about 20 minutes to build and install

In the end, compiling and installing MySQL this way is well worth the effort, as the end result delivers an easy-to-upgrade, system-independent, stand-alone development platform that is impervious to potential problems that can be caused by system updates, operating system upgrades, etc.

By rolling our own from source this way, we also have full control over our environment. We know what’s installed and where, what version we’ve used, where it came from, and there’s no dependence on an external ports system and the breakage or issues that come from relying on others to manage our software.

These issues and additional background information about why one might roll their own tools in this fashion are detailed in the article, Using /usr/local/, which could be considered a prerequisite for this task.

A Quick Warning

While it’s unlikely anything we do here might do any kind of damage to the system, it’s good advice to have a current backup of everything, just in case. I don’t take any responsibility for anything that results from following these instructions. You’re following these instructions at your own risk.

Prerequisites

You’ll need to install Xcode. Xcode can be found in the Optional Installs folder of the installation DVD. You can also download the latest version from Apple by getting a (free) membership from the Apple Developer Connection.

Just double click the Xcode installer package, take the defaults, and you’ll be ready to roll.

A Note About Existing MySQL Installations

If you already have MySQL installed and used the package installer from MySQL to install it, you need to remove a single file (actually a symlink) to disable it:

sudo rm /usr/local/mysql

If you also installed the StartupItem package, you’ll want to remove it as well. Keep in mind that if you ever want to auto-start the old version of MySQL later on, you’ll need to re-download the package installer and reinstall the StartupItem.

sudo rm -rf /Library/StartupItems/MySQLCOM/

Exporting or migrating your old data isn’t difficult, but it is beyond the scope of this article. I may write something up to handle this in a subsequent article if it’s something people want.

Terminal

We’re going to be typing archaic commands into a window using a monospaced font, just like in a movie! And if things go well, later, your life-sized avatar will learn kung-fu.

Open the Terminal application. It can be found in the /Applications/Utilities folder.

Each of the lines below appearing in monospaced type should be entered into Terminal, and be followed by the Return key. But you knew that already.

Setting the Path

Do not skip this step! Most everything else will fail if you do.

Mac OS X, like other UNIX systems, uses something called a path to determine where it should look for applications on the command line (that is, when you’re using the Terminal app). The path is actually an environment variable, set by a special file that’s automatically executed when you open a new Terminal window.

To see if the path has been set properly, we can check the contents of the .bash_login file (the special file hidden in our home folder) for a PATH line using a text editor. TextMate, TextWrangler, BBEdit, and vi are all perfectly good options. To open the file with TextMate, for example, we can type:

mate ~/.bash_login

This will open the file if it already exists, or open a blank file if it doesn’t. Add the following line at the very end of the file:

export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" 

Now save and close the file.

It doesn’t matter how many other lines there are in the file, or what they say or do. Just make sure that this line comes last and you should be fine.

To make sure the changes are picked up correctly, we now need to execute the file with the following command:

. ~/.bash_login

It’s likely there will be no response from the shell here, just the prompt, but that’s OK, the changes have been picked up and we’re ready to move on.

You can also close your Terminal and open a new one instead if you’d like.

Setting Up

I like to create a folder to contain the MySQL source code file and build folder. This way, I can later uninstall MySQL easily, as well as download and compile new versions, all in one place.

For these examples, we’ll create a folder called src in our home folder, and change directories into that folder. It will be our workspace for everything we do here:

mkdir -p ~/src
cd ~/src

You’ll download and compile everything in this new folder.

Download, Extract, Etc.

Now we’re ready to start the real work. Just type (or cut-n-paste) each one of the following lines into Terminal, one by one. When one line finishes (some will take a while and dump a lot of information to the screen), enter the next one.

This will first download and then expand the MySQL source code distribution:

curl -O http://mysql.he.net/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz
tar xzvf mysql-5.0.45.tar.gz
cd mysql-5.0.45

You then need to configure MySQL:

CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql \
--with-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile --enable-shared

When that process completes, you can initiate the actual compilation process:

make

This part can take a while. Now is a good time to go and get yourself a tasty beverage.

The last part of the build process is where MySQL actually gets installed. You’ll be prompted for your password here, because this is where files actually get written to their actual locations:

sudo make install

Next, we need to setup the initial databases and privileges. You may be prompted for your password again:

cd /usr/local/mysql
sudo ./bin/mysql_install_db --user=mysql
sudo chown -R mysql ./var

That’s it, MySQL is installed. But you’re not done yet.

Auto-Starting MySQL

Now that the install is done, you need to have MySQL auto-start every time you start or reboot your Mac. The easiest way to do this is using launchd.

I’ve prepared a launchd plist file that will manage MySQL, starting it at boot and stopping it cleanly at shutdown. Create a file named com.mysql.mysqld.plist using the text-editor of your choice, and save it to your Desktop. Enter the following text into the file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>KeepAlive</key>
    <true/>
    <key>Label</key>
    <string>com.mysql.mysqld</string>
    <key>Program</key>
    <string>/usr/local/mysql/bin/mysqld_safe</string>
    <key>RunAtLoad</key>
    <true/>
    <key>UserName</key>
    <string>mysql</string>
    <key>WorkingDirectory</key>
    <string>/usr/local/mysql</string>
</dict>
</plist>

Now we need to move the file into place and set the permissions on it. You may be prompted for your password again:

sudo mv ~/Desktop/com.mysql.mysqld.plist /Library/LaunchDaemons
sudo chown root /Library/LaunchDaemons/com.mysql.mysqld.plist

With the file in place, the last step is to tell launchd to load and startup MySQL. You may be prompted for your password again:

sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist

If things go well, you won’t see anything special happen, but MySQL will have started up. You can verify this, again back in Terminal:

mysql -uroot

This will initiate MySQL’s command-line monitor. If everything went well, you should see something like this:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql&gt;

If you see that, that’s it, you’re done! Type exit to quit the MySQL monitor.

If you see something else, verify that your paths are set correctly and try the command again. If things still don’t work, it’s likely that something didn’t work and the compile didn’t finish. Try going through the steps once more and see if you can catch any error messages.

Starting and Stopping MySQL Manually

If you ever want to stop MySQL manually, use this command in Terminal, entering you password when prompted:

sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist

To start it manually, use this command in Terminal, entering you password when prompted:

sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist

A Note about Security

The easiest way to secure your MySQL installation without affecting the way you (or your applications) will need to communicate with it is to limit anything but local connections to your MySQL server. In other words, only you and the apps you run on your own Mac will be able to connect. You won’t need to enter passwords when interacting with MySQL locally, and won’t need to tweak the default database.yml files that Rails creates, for example.

We can limit access by creating (or editing) the /etc/my.cnf file. If you have TextMate installed, you can enter the following command to create (or edit) the file:

mate /etc/my.cnf

If you use BBEdit, you’d use this command:

bbedit /etc/my.cnf

The handy bit about using TextMate (or BBEdit) for this task is that it will handle authentication and setting permissions for you.

Enter the following text into the file save it and close it, authenticating as needed:

[mysqld]
bind-address = 127.0.0.1

Thanks to my friend Mike Clark for this tip.

If limiting access isn’t enough for you, you can read about setting a root access password for MySQL in this article.

Baking-In the MySQL Bindings

You can gain some bigtime Rails-to-MySQL speed improvements by building the MySQL C bindings for Ruby.

If you have an Intel Mac, just run the following command (entering your password when prompted):

sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

If you have a PPC Mac (I hear some still exist), you’d enter:

sudo env ARCHFLAGS="-arch ppc" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

You’ll see a prompt asking you which gem to install:

Select which gem to install for your platform (universal-darwin9.0)
 1. mysql 2.7.3 (mswin32)
 2. mysql 2.7.1 (mswin32)
 3. mysql 2.7 (ruby)
 4. mysql 2.6 (ruby)
 5. Skip this gem
 6. Cancel installation

Pick the option closest to the top that ends in “(ruby)”. In the example above, we’d want to select option 3.

Uninstalling MySQL

In case you one day decide that you’d like to remove MySQL, it’s easy to do when building from source:

cd ~/src/mysql-5.0.45
sudo make uninstall
sudo launchctl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist
sudo rm /Library/LaunchDaemons/com.mysql.mysqld.plist

That’s It

So, you’re done. What are you waiting for? Go create the next Google or something.

Special thanks to Koz, Mike Clark, Ryan Schwartz, and Jason Seifer for their tips and suggestions.

Comments

Oliver Beattie ·

Thanks for this, the stuff with the PLIST file really helped me out (don't have a clue about stuff like that [fine with the building etc. part though!])

Cheers!

Steve ·

Nice piece. One thing I do on my development machine is make a mysql_data directory in my home directory, and add a symbolic link from data in the mysql install directory to that data directory. That way it's easy to work with the data, such as duping it, and also easy to not squash the data directory when upgrading.

Axel Johnsson ·

Thanks for this tutorial, but i wonder one thing. Can i delete src folder in the userfolder?

Oliver Beattie ·

I'll answer that one if you don't mind: yes, but if you want to uninstall MySQL at some point, you'll need to re-download the source, configure and compile it again before you can run ``make uninstall``.

For the sake of 250mb, I'd probably keep it (unless you're on a really tight on space).

Once again, thanks for the great article!

Dan Benjamin ·

Axel: Oliver is correct on both counts - you can delete it, but it would be best to keep it around. This would enable you to uninstall it later if needed.

If you're concerned about space, you can create a compressed archive of the folder and then delete it.

kroko ·

i did a clean install of leopard and right now i'm up to rebuild webserver from base. thanks for great tutorial, i had forgotten nearly all of this:)
one question though:
you're suggestion of src folder... i'd like not to "dirty" my home folder, so what about using /src instead of ~/src? it doesn't make differnce, does it?
thanks in advance,
kroko

CGI development with OSX Leopard, part 6: MySQL at RedBlog ·

[...] Hivelogic: OSX Leopard MySQL Install Instructions [...]

Will Powers ·

I tried doing this twice and the whole thing is perfectly OK until I get to the very last step, "mysql -root", and I get an error message. I am on leopard, and I am trying to get MySQL to work with Ruby on Rails; I am using the book Agile Web Development With Rails, and I can not move on until this is fixed. any help would be much appreciated!

Last login: Thu Dec 27 12:19:24 on ttys000
Macintosh-5:~ williamtpowers$ mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Macintosh-5:~ williamtpowers$ sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist
com.mysql.mysqld: Already loaded
Macintosh-5:~ williamtpowers$ mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Macintosh-5:~ williamtpowers$

Axel Johnsson ·

Okey, i keep the src folder. =)

Grant Neufeld ·

kroko: I, too, don’t want the src dir in my home directory. I put in /usr/local/src (which works fine).

Note that the shell script Dan provides for this builds the ruby gem for Intel processors. If you’re installing on a PPC system, change the “i386” in the second last command to “ppc”.

kroko ·

Grant:
thanks! your answer is perfectly timed:) postponed mysql as long as possible- it always have been painful experience, at least for me. and i'm on mactel, but thanks for pointing out to others as well.

Dan Benjamin ·

You can put the "src" folder anyplace you want. You can delete it later. You can keep it in your Documents folder, etc.

Bryan ·

@Will Powers:

I believe it is because you left out one part. The same thing I forgot the second time I installed and it gave me the same problem. Shut down your server then:

cd /usr/local/mysql
sudo ./bin/mysql_install_db --user=mysql
sudo chown -R mysql ./var

and restart. That should do it

kroko ·

Dan: thanks for the article, saved me a lot of time.
have php,cgi&ssi,mysql running. perl and dbi still to come:)
one thing you forgot to mention: the problem of mysql.sock and php. php is looking for /var/mysql/mysql.sock while mysql still puts it in /tmp/mysql.sock. lets hope mysql will upgrade for leopard.
for now we have to change temporaly /etc/php.ini file for php+mysql to work.

sudo cp /etc/php.ini.default /etc/php.ini
sudo nano /etc/php.ini
search for and change to:
mysql.default_port = /tmp/mysql.sock
mysql.default_socket = /tmp/mysql.sock

sudo apachectl restart
sudo /usr/local/mysql/bin/mysqld_safe

---
i do some webscripting but as mentioned before-webserver installation, configuration, maintenance is not what i do in my everyday. so the question is- when mysql leopard version comes out, do i have to uninstall current mysql version before installing the new version? will simple upgrade delete mysql.sock from /tmp/mysql.sock and move it correctly to /var/mysql/mysql.sock ? thanks! :)

Damien Caselli ·

Very nice article, thanks very much ! :)

Damien Caselli ·

Very useful article, thanks very much ! :)

Will Powers ·

@Bryan,
thanks! I got it to work, and fyi, there was also one more thing I had to do, and that was set the permissions to "read and write" for all of the mysql folders, they were on "read only".

Mark ·

Great article.

I'm curious, though. If I don't want to have mysql launch at startup or reboot automatically (all the plist stuff), what commands do I use to start and stop the server? Surely the manual start and stop instructions in the article only work if you've configured the automatic start already.

Wreck ·

Oooh excellent, i've been wanting to do this for a while now.

Before i begin because i will be the first to admin, i'm not real good with this sort of thing. Will i be able to run vBulletin locally?

Is anyone doing this on the above setup?

Thanks for the article, bookmarked.

Dave ·

Thanks for this article. I used the hivelogic_mysql_setup.sh script and it worked just fine. I forgot to add the export path statement to my .bash_profile file and that caused me about an hour of un-necessary headache. But after an "aha" moment with careful re-reading of this article, I modified my PATH variable and all was well. I had MySQL set up on a G5 imac, but the power supply melted and I had to move to a mac mini.

Domingo ·

If you want to create innodb tables by default (my compilation of MySQL doesn't do that) you can add this code in the plist file, after the Program key:

ProgramArguments

/usr/local/mysql/bin/mysqld_safe
--default-table-type=innodb

Domingo ·

I'm trying to post the code again (WordPress deleted all the XML stuff):

<key>ProgramArguments</key>
<array>
<string>/usr/local/mysql/bin/mysqld_safe</string>
<string>--default-table-type=innodb</string>
</array>

akkdio ·

Domingo,
where do you put your code?

Akkdio

Adam ·

I've tried these instructions about 3 times so far, and I keep getting the following once I try to launch mysql from the command line:

Macintosh:~ adam_mika$ mysql -uroot
-bash: mysql: command not found

I can log into localhost from CocoaMysql and create tables and the such, but I can't seem to get it working from the command line. Any ideas?

Gnarlodious ·

The supplied installer script works excellently in 10.5 on Intel hardware. Just make sure your command $PATH is accurate.

Thanks for the instructions!

-- Gnarlie

Philly ·

@Adam

I get the same message on my install when I try mysql-uroot. However, it works when I add a '.'. See below:

"bin dolphin$ ./mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> exit
"

Hope that helps...

Dan Benjamin ·

@Philly and @Adam - make sure you've set your path to include /usr/local/mysql/bin or it won't work.

Kristin Andrus Pishdadi | Installing MySQL on Mac OS X ·

[...] Installing MySQL on Mac OS X [...]

Sgiandhu ·

Great tutorial. I had set up MySQL on Leopard and previous versions of OSX using compilers, so this has been my first attempt without them. And I've run into trouble :).
All was going well until I got to here:

CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql \
--with-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile --enable-shared

and I got this response:
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.

I have no clue what to look for in the config.log to tell me what the problem is. Can anyone help, please/
Many thanks

Dan Benjamin ·

@Sgiandhu - you just need to install XCode tools, as explained in the instructions. It should be on your install DVD or available from apple developer connection.

Sgiandhu ·

Argh, I thought i did have them installed as I have X11 showing in my Utilities folder. Once installed, where do I begin from to get this finished?

Thanks

Sgiandhu ·

XCode tools installed... and MySql up and running.

Thanks for nudge and the great tutorial!

Sergio Rabiela ·

you can hook up the man pages in case you wanna check those out too.

add:
export MANPATH=$MANPATH:/usr/local/mysql/man

in ~/.bash_login

lance ·

hi-

sudo chown -R mysql ./var

gives owner _mysql (note the leading underscore) with uid of 74.

Tiger had mysql uid defined in NetInfo. Where is it defined in Leopard?

What is the leading underscore for?

Moodle, MAMP, Wordpress ·

[...] Installation of MySQL: http://hivelogic.com/articles/installing-mysql-on-mac-os-x/  [...]

Dan L. ·

Thanks a ton for this tutorial!

Eivind ·

Thanks for the guide. I was a bit hesitant to build MySQL myself, as I only have a 1.33 GHz G4, but it only took 45 minutes.

Mack ·

Hi everyone, I get this error at the last step.
mysql -uroot
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Mack ·

None of the above suggestions work.

Josh ·

Everything worked for me. Though I noticed that the mysql interactive shell doesn't seem to be compiled with readline. I have gnu readline built out into /usr/local. Any help would be much appreciated.

David ·

All is well until I get to the MySQL C bindings. I got as far as selecting option 3, and when I hit return, it did nothing. It's still not displaying anything in that window, but the fan is running like crazy and the CPU is at 192! Anyone else seeing this?

atsuhiro ·

your article is briliant!!
I had been trobled in install mysql and mysql/ruby for a long time.
wow, I could install them properly in this time. you are great!

P.S. I'm a japanese student. your article is not also useful for American but for Japanese.

Thank you!

Waffle With Meaning &raquo; Installing PHP, MySQL and phpMyAdmin on OS X 10.5 (Leopard) ·

[...] line geek so I was definitely looking for help here and fortunately found it in an article called Installing MySQL on Mac OS X at Hivelogic. This article takes you through the entire process including downloading the source from the [...]

Kevin ·

Hi Dan, let me first say thanks for the post. I'm kind of new to this, graphic design is main bag, but I love to learn new software, scripting, etc... So my question really is what does the configuration scripting mean and are there any sites/reference books for a thick-headed person like me to learn what is going there?

CC=gcc CFLAGS=”-O3 -fno-omit-frame-pointer” CXX=gcc \
CXXFLAGS=”-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti” \
./configure –prefix=/usr/local/mysql \
–with-extra-charsets=complex –enable-thread-safe-client \
–enable-local-infile –enable-shared

Thanks,
Kevin

Trey ·

Dan,

Thanks much, man. Worked like a charm.

Trey

Kingy ·

"While it’s unlikely anything we do here might do any kind of damage to the system, it’s good advice to have a current backup of everything, just in case."

" You’re following these instructions at your own risk. "

You are the best, Dan :)

Dan Benjamin ·

@Kingy - well you know what they say, "no good deed goes unpunished."

Yathindran ·

HI very nice article... worked superbly... am a freshman learning programming... can u pls help me install mysql++ on leopard so that i can do some c++ program and access mysql with the same... pls help me... quite urgent
thanx
yathindran

yathindran ·

hi dan benjamin
can u pls tell me wether i can access mysql database only with mysql++ install... i tried creating a program using xcode ->new project command line utility c++ tool...
i got many errors... and i read that i need mysql++... i downloaded mysql++ but struck with installation... can u pls help me with that...
after installing(i havent installed) should i do things as given in this site
http://forums.mysql.com/read.php?117,51324,127220
it would be great if u can help
thanx
yathindran

-]CyHunter[-[X] ·

well when i finish i put mysql -uroot.
and say command not found what i do wrong ????

Will ·

@Dan - you mentioned "Exporting or migrating your old data isn’t difficult, but it is beyond the scope of this article. I may write something up to handle this in a subsequent article if it’s something people want." I've found postings on other sites with instructions for data migration, but none of them work, and most break MySQL (ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)). Your instructions are always so clear and detailed, that I for one would really appreciate it if you did an entry on migrating data from a pre-mysql-5.0.45 on Tiger to mysql-5.0.45 on Leopard.

Alan ·

Dan,

Thanks so much for this tutorial. I got to the end of it, and the mysql daemon was not running. I looked in Console and found the following (repeated about 10,000 times):

1/14/08 12:52:37 PM com.apple.launchd[1] (com.mysql.mysqld[76172]) Suspicious setup: User "mysql" maps to user: _mysql
1/14/08 12:52:37 PM com.mysql.mysqld[76172] Starting mysqld daemon with databases from /usr/local/mysql/var
1/14/08 12:52:39 PM com.mysql.mysqld[76172] STOPPING server from pid file /usr/local/mysql/var/enyo.local.pid
1/14/08 12:52:39 PM com.mysql.mysqld[76172] 080114 12:52:39 mysqld ended
1/14/08 12:52:39 PM com.apple.launchd[1] (com.mysql.mysqld) Throttling respawn: Will start in 8 seconds

(enyo is the name of my computer).

So I changed the user in com.mysql.mysqld.plist from mysql to _mysql, and after rebooting, I think it works. Maybe this is the problem that other people ran into.

Lidija ·

ok, when you say not to skip a part of these instructions, you mean it. i learned the hard way! :-) thank you for these instructions. i've been agonizing for weeks, not being able to figure out why i couldn't get mysql to work. seeing how i've never opened terminal on my mac in the ten years i've owned one, this was a challenge. let's hope there are instructions on actually using mysql out there written as well as these. thanks!

Phil ·

Thanks for this tutorial! awesome work!

Keith Veleba ·

Thanks for the tutorial, but I'm wondering if I missed something. Trying to compile 5.0.51 on 10.4.9 Dual 2.5GHz/G5 4GB RAM Mac Pro.

Getting this error when executing "make":

/usr/bin/libtool: for architecture: cputype (16777234) cpusubtype (0) file: -lm is not an object file (not allowed in a library)
/usr/bin/libtool: for architecture: cputype (16777234) cpusubtype (0) file: -lSystem is not an object file (not allowed in a library)
make[2]: *** [libmysqlclient_r.la] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

Any thoughts?

Pål Degerstrøm ·

Thanks a lot, Dan.

How about an article on installing PHP on Leopard? I know it comes preinstalled, but it's without PEAR ('--without-pear') and it would be useful to have a reference on how to install it.

Also, I thought I'd mention that I migrated my MySQL data from my Tiger install, and it seems that data is now stored in the "var" directory, and not in the "data" directory as in Tiger (and earlier). If you copy your data like this, remember to change ownership and permissions on the directories you're copying (using "chown" and "chmod").

Thanks again!

Craig Bailey ·

Thanks so much for the great tutorial. There are loads of instructions on the Net for setting up MySQL, etc., but I have never come across a more helpful, straight-forward set than yours.

I'm passing on a little donation for your efforts. Have a beverage of your choice, on me.

Dan Benjamin ·

I have thought about rolling a "Building PHP on Leopard" article (as opposed to an article on "enabling" it).

Would this be interesting to enough people?

Craig Bailey ·

Ran into a small glitch someone might be able to help with: Though my MySQL install is working great through the command line, my PHP give me an error: "Warning: mysql_connect() [function.mysql-connect]: Can't connect to local MySQL server through socket ..."

Do I need to set a socket location in php.ini to match my MySQL install? What would it be?

Pål Degerstrøm ·

@Craig Bailey: In your php.ini, you might have to do

mysql.default_socket = /tmp/mysql.sock

I had to, because Leopards PHP points to /var/mysql/mysql.sock by default (at least mine did).

Pål Degerstrøm ·

@Dan: I meant that you should write the PHP article *now*, or else I'll have to figure it out by myself :-)

Seriously, the PHP instructions seems out of date with the launch of Leopard (http://www.php.net/manual/en/install.macosx.php), and the Liyanages module (http://www.entropy.ch/software/macosx/php/) only states support for Tiger (and the PHP page actually recommends using the Liyanage module).

Thanks again, Dan.

-]CyHunter[-[X] ·

can anybody help me with the mysql root when i finish the installation i put mysql -uroot and this massage appear
"ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)"
and im rookie in this of roots anybody can help ?????
-]CyHunter[-[X]

Great links for Unix and Mac OSX &laquo; Any thing goes &#8230; ·

[...] How to install mysql on Mac OSX from hivelogic [...]

Setting up MySQL on Leopard &laquo; Accidental Technologist ·

[...] behavior I didn’t want to have to deal with. I found a great blog post from Hivelogic called Installing MySQL on Mac OSX. This post was dead-on and saved me a ton of time and I hope this post will guide you to solving [...]

ucantblamem ·

@Keith - Try doing "sudo make" instead of just "make".

links for 2008-01-20 &laquo; Accidental Technologist ·

[...] Installing MySQL on Mac OS X at Hivelogic Great tutorial on getting MySQL up and running on the Mac with Leopard (tags: mysql leopard) [...]

Margaret ·

I am so impressed! I can bumble around all right in bash, but I tend to get stuck in complex make-make-install efforts. But these steps worked for me (on 10.4) without a hitch! My first-ever painless manual install - now I can just kick back and wait for my kung-fu skills to materialize. :) A small contribution is on the way as a token of thanks.

p.s. I would definitely be interested in a PHP article.

dc ·

getter this error on you mac?

(Can't connect to local MySQL server through socket)

Here is a fix that would get you through - though would love somehting tighter?

http://6brand.com/rails-socket-config-can-t-connect-to-local-mysql-server-through-socket

Dr. Sesser ·

Great publishing. Let everyone know if there SQL command will show nothing just open a new terminal. Setting the profile in that fashion applies to $PATH s there after. Great walk through happy SQLing

B

John Lynch ·

See http://mechanicalrobotfish.com/posts/115-ruby-rails-and-mac-os-105

for
“ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)”

the install_db script needs to be updated for improper hostname return.

HTH

Pål Degerstrøm ·

Marc Liyanage just released a beta 2 of his PHP module (using PHP version 5.2.5): http://www.entropy.ch/phpbb2/viewtopic.php?t=2940. Works just fine on my MacBook Pro running Leopard.

h MacKiernan ·

I ran into a few issues trying to build from source on Leopard (10.5)
First, permissions for the 'tmp' directory; this was solved by specifying --tmpdir=/usr/local/mysql/temp (after having created 'temp')
this allowed mysql_install_db to not fail, as well as mysqld_safe
to start up.

the problem is, I was never prompted for a root password for the 'mysql' user, and when I start 'er up with --skip-grant-tables; the system tables are _therE_ but are _empty_ -- is this supposed to be the case? install_db reported no errors

Andrew Brown ·

I'm having trouble getting mysql onto leopard.
I'm receiving the:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I'm using mysql-5.0.51 instead of 5.0.45 since the curl would fail.
I can't find mysql.sock anywhere.
I want to get railing

Colin ·

I am running a 2.6ghz Intel Core 2 Duo with 10.5.1 Mac OS.

I tried running the shell script and Ruby as well. I received:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

when trying to use : mysqul -uroot

i uninstalled and reinstalled with shell script. this time, no ruby.

now i get :

-imac:mysql-5.0.45 Colin$ mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 Source distribution

AJP ·

Just wanted to say thanks...your directions worked perfectly.

Gary ·

Excellent atricle!!!! worked like a charm... its helping us south africans get on the rails road too

Feisal ·

Hi thanx for the article.
I've run into a sligt problem. I keep getting the same error when i try to create e new datebase:

(errno 2) I've tryed to google myself to a selution, the closest i've got to one is the cause ---> http://lists.mysql.com/mysql/984

How do i go about fixing this? any ideas ?
thanx!

DL Byron ·

Thanks for this . . . there still isn't a mysql package for leopard, the Tiger one works, but the prefpanes and startup scripts do not. I removed those and installed this and it works.

goingup ·

Hi,

Thanks for the great article.. I've got 5.0.45 running on my shiny new quad core xserve..

I would like to use MySQL Admin with this to manage starting, stopping, startup and cnf.. but I get a message 'ERROR: MySQL manager or server PID file could not be found.'.

Does any one have a clue where to change the default location for the PID or any other suggestion?

Thanks!

Pierre29 ·

First, thank you so much for this tutorial.
Unfortunately, something is wrong for me and after serveral install and uninstall, i need help to find solution.

I'm on powerBook G4.
The install process works until
sudo make install
instruction.

At this step :
cd /usr/local/mysql
sudo ./bin/mysql_install_db --user=mysql
sudo chown -R mysql ./var

it appears an error with :
sudo ./bin/mysql_install_db --user=mysql
----
PortablePierre-6:mysql ple$ sudo ./bin/mysql_install_db --user=mysql
Password:
Installing MySQL system tables...
080125 20:18:13 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/ is case insensitive
ERROR: 1049 Unknown database 'mysql'
080125 20:18:13 [ERROR] Aborting

080125 20:18:13 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

Installation of system tables failed!
----
and the var folder doesn't exist...

So, after many and many attempts to make work mysql, i have put much hoping on this tutorial and i would be very grateful if somebody can help me.

Thanks,

Pierre

Put Together Quickly &raquo; Installing Ruby on Rails on Mac OS 10.5 or patching Dan Benjamin&#8217;s guide ·

[...] finally we’re ready to follow Dan’s instructions to install [...]

Andrew Brown ·

MySQL Conquer'd

I fix my problem: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

1. I think I skipped this step:

cd /usr/local/mysql
sudo ./bin/mysql_install_db --user=mysql
sudo chown -R mysql ./var

Then I preceded to do:

2. sudo /usr/local/mysql/bin/safe_mysqld
3. sudo mkdir /var/mysql/
4. sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Talk about painful, searching through all those mysql bug tickets.

Tony ·

I just got a macbook pro and searched the .bash_login file in vain. I went an extra mile and created the following ~/.bash_login , ~/.bash_profile, ~/.profile and ~/.bashrc files putting in path info but my system (leopard) seems to be using a different file. On my macbook I have the older OS TIGER on it. There i set all my system paths in the /.bash_profile file but im just lost with leopard. I find it strange that no one here has this problem. I would be grateful if someone helps me. Thanks

M Koskinen ·

Thanks for the create advises. Had some troubles with MySQL after I installed Leopard but whit these instructions everything is back to normal again.

John ·

I get:

ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)

I tried every fix for this suggested here and nothing works. It's looking like this is a permissions or _mysql vs mysql user problem. I think the above instructions only work if you upgraded to leopard. A clean install of leopard followed by the above instructions doesn't work.

Niklas B ·

One thing to note:
Make a fresh backup. The first thing you do is to delete (rm) all traces of your database. I was bitten by this and lost 36 hours of data because I thought this was safe because you talked about exporting data _after_ using the rm. Well, stupid me for not doing what I was supposed to do.

Shelly ·

Thank you!!! I'm a dumby with this stuff, but I actually managed to make it through :)

The only snag I had was when I tried 'Setting the Path'. I didn't have TextMate installed on my computer before, and after I installed it and typed the command in Terminal (mate ~/.bash_login) it still didn't work. I had to restart my computer, and then Terminal recognized what to do right away.

Thanks again!

Bryan ·

done and done. Thank you for this easy to follow tutorial! There is a slightly newer MySQL version, 5.0.51a. you can find it here: http://ftp.up.ac.za/pub/windows/MySQL/Downloads/MySQL-5.0/
grab this one: mysql-5.0.51a.tar.gz and just make sure you change the file name in the tar step to match the new version. Thanks again!

jay ·

thanks for your post.

i've tried many ways to install mysql onto leopard in the past, all failed. your post worked for me.

please keep writing great posts and save time for all the lost developers out there.

Xavier ·

Thank you very much! This article was great. I just got a mac-mini and wanted to make it a secure web server. I need to make my own PHP built because I might need more things from what Leopard comes with. Anyway, I found an article on how to enable Apache and PHP with PEAR on Mac OS X Leopard. Its very simple! :)
http://www.procata.com/blog/archives/2007/10/28/working-with-php-5-in-mac-os-x-105/

~ Xavier

ruby gem?mysql?????? | shake4me blog ·

[...] Installing MySQL on Mac OS X [...]

Philip Kebbell ·

What a great article! I've been struggling for 3 days trying to get MySQL to run on Leopard without success until I found this site. I have very little experience with Unix or MySQL so it is really great to find someone who can provide a step-by-step installation guide.

Many thanks to all concerned.

Regards

Philip

Phil ·

Re: “ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)”

for those of you who were having the 1045 error. I was able to get into the mysql command prompt by issuing the following commands:

sudo su
mysql -uroot -p

you'll be prompted for your password. then booYah!

This may not be a good solution for long term use, but it worked for me.

Ulf ·

Hi,

thanks for the great tutorial :-) Unfortunately the make process fails:

make[3]: Nothing to be done for `all-am'.

Any thoughts? Please help out...

Thanks, Ulf

Adam ·

Works flawlessly! Thanks!

Javier ·

I followed your instructions on how to compile mysql and success fully installed it at ~/src. But when I try to use a GUI like cocoaMYSQL I am unable to connect to mysql server although I am able to connect through the terminal window. What could I be doing wrong?

Kelly ·

This article is awesome! Thank you.

Simon ·

Thank you, Dan. Every step worked as instructed. Appreciate it.

Ron Winckler ·

Hi,

I don't know if you still monitor this area but I'll give it a try. I followed all instruction above (changing download path to --http://mysql.he.net/Downloads/MySQL-5.1/mysql-5.1.22-rc-osx10.4-powerpc.tar.gz --).
Also changed references to newer version as necessary. All downloads and unpacks successfully. When I get to the "make" step, I get the following message: "No targets specified and no makefile found. Stop."
Am not able to proceed further. Any ideas?
Thanks

Chris ·

Awesome tutorial, lots of help, very well written. Thanks!

Tom ·

Great help thanks!

Can anyone help - stuck with groupadd /addgroup and useradd as I'm getting a :command not found. Tried running from the sbin directory but get same error - infact none of these files appear in the /usr/sbin dir?

Thanks in advance.

iMac MAMP Server &laquo; Random Advice ·

[...] This is the most technical part of the setup, and it takes a few minutes. I found the following post at Hivelogic to be extremely helpful: http://hivelogic.com/articles/installing-mysql-on-mac-os-x/ [...]

Ken ·

Just wanted to say thank you, excellent instructions, surprising how little info there is on the web regarding this. Thank you again, worked like a dream.

Rake Tasks for dumping mysql at Ivan Enviroman ·

[...] have definitely used sqlite database files but I also like sticking to mysql, because I know that’s what I’ll use on the the server. I’ve created some rake [...]

Alex ·

Hey, thanks so much for this tutorial!
Everything worked out perfectly, however everytime I open a new terminal window I have to run ~/.bash_login for the mysql command tool to work.
Is there any way to fix this? where did I go wrong?
Thanks!

Hans ·

I've failed to figure out why my make (mysql-5.1.23-rc on OSX 10.5.2) fails at:

Making all in t
if gcc -DHAVE_CONFIG_H -I. -I. -I../../../include -I. -I../../../include -I./.. -I../../../include -O3 -fno-omit-frame-pointer -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -MT basic-t.o -MD -MP -MF ".deps/basic-t.Tpo" -c -o basic-t.o basic-t.c; \
then mv -f ".deps/basic-t.Tpo" ".deps/basic-t.Po"; else rm -f ".deps/basic-t.Tpo"; exit 1; fi
/bin/sh ../../../libtool --preserve-dup-deps --tag=CC --mode=link gcc -O3 -fno-omit-frame-pointer -D_P1003_1B_VISIBLE -DSIGNAL_WITH_VIO_CLOSE -DSIGNALS_DONT_BREAK_READ -DIGNORE_SIGHUP_SIGQUIT -DDONT_DECLARE_CXA_PURE_VIRTUAL -L../../../unittest/mytap -o basic-t basic-t.o -lmytap -lm
libtool: link: cannot find the library `' or unhandled argument `-'
make[3]: *** [basic-t] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all-recursive] Error 1

Any ideas much appreciated. Thanks.

Tom Morrison ·

This worked great for getting MySQL up and running under Leopard.

I do have an issue with the support binaries that come with MySQL. They are all still ONLY sitting in my ~/src directories. Commands, such as mysqladmin, never got moved to the /usr/local/mysql directory structure. Is there a best place for those files? How about ownership and permissions -- what should they be set to?

Thanks for the tip. I had not been able to run MySQL since upgrading to Leopard and your article addressed that very well.

Hivelogic: Installing Ruby, Rubygems, Rails, and Mongrel on Mac OS X 10.5 (Leopard) ·

[...] locally though, and want to install the MySQL gem for better Rails integration. If you followed my MySQL for Mac OS X installation instructions or used one of the official MySQL distributions, your MySQL lives in /usr/local/mysql. You can [...]

Ploafmaster General &rsaquo; Ruby from the Hive Mind ·

[...] I get home I’m going to take a stab at it, but I’m sure it’ll be as easy as his previous efforts. This was written by Ploafmaster General. Posted on Thursday, February 28, 2008, at 4:27 [...]

Jon ·

I've uninstalled and installed mySQL three times. And it seems that I can not communicate with mySQL. Every time I enter mysql -uroot it always comes back with command not found. I've followed this tutorial and the one for installing rails and I get the same thing. Were am I going wrong?

Bryan C. ·

If you still having the missing mysql.sock error you might want to check the contents of your plist file from above. If you used TextEdit or another tool to create the file it may have added additional coding syntax (like "/" at the end of lines and rtf formating) that is causing that file to not load. If that file does not load, the mysql.sock is not created in the /tmp folder. Clear out that added data by using vi or TextMate then save the file and try to load it again. It loaded successfully you should see it return to the command prompt and if you check /tmp there will be a mysql.sock file there.

yaniv ·

thank you for this tutorial, as well as for your ruby on rails installation tutorial. i went through both installs step by step per your instructions. my confidence built with each command that went through successfully. this was really a stress-free setup day. thank you.

Stephen ·

Thanks so much for the writeup. One typo though...

"mysql -uroot" should be "mysql -u root"

Brad ·

Great article, but a couple of notes/problems with the launchd script in regards to Tiger.
First, I tested the launchd script in both Leopard and Tiger, and it worked as advertised with Leopard, but not Tiger. Granted the versions of MySQL I was using were not exactly the same, but they were both in the 5.0.x family, and I think the issues I've discovered were do to launchd.

1) The KeepAlive option is a Leopard-only option and replaces the depricated OnDemand option that Tiger uses. In Tiger OnDemand is the functional equivalent to your KeepAlive

2) MySQL in Tiger can not be stopped my issue the "sudo launchctrl unload -w /Library/LaunchDaemons/com.mysql.mysqld.plist" command. If you want to manually stop MySQL, you do have to issue that command first, but then you still need to issue a command to stop MySQL. (Whether that's using the mysql.server script, mysqladmin command, etc.

Brad ·

Ok, the comments ate my angle brackets in point # 1, so substitute them where you see the square brackets below:
[key]OnDemand[/key] is the functional equivalent to [key]KeepAlive[/key][true/]

Brad ·

errr, [key]OnDemand[/key][false/] is the functional equivalent to [key]KeepAlive[/key][true/]

Drew McKinney ·

For those of you getting the /tmp/mysql.sock error...

You are probably like me: tried to install the packaged solution, didn't have luck, and came here for an answer.

First and foremost, make sure you remove ANY mysql stuff pre-existing on your machine. This was the step that finally got everything working for me. Clear out everything including the /usr/local/mysql stuff.

Next, follow these steps to a tee. This should work after that.

Good jesus this was a difficult install. BTW, I'm using Leopard on the newest (Mar 2008 release) Macbook Pro.

Chris ·

I've followed the instructions exactly, but when i get to:

"If things go well, you won’t see anything special happen, but MySQL will have started up. You can verify this, again back in Terminal:
mysql -uroot"

i get a "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)"

I've tried changing the localhost thing in the mysql_install_db, but that didn't do anything. I've uninstalled and reinstalled mysql, I've even tried using the mysql version 5.0.51a.

I'm on a macbook pro running 10.5.1. I'm new to all this, any help would be appreciated.

links for 2008-03-16 | Libin Pan ·

[...] Hivelogic: Installing MySQL on Mac OS X Installing MySQL on Mac OS X (tags: mysql leopard osx mac) [...]

Brendon ·

Hello Dan,

I have no previous experince with coding, but I purchased a book on ruby on rails to try to teach myself in my spare time. I found your site as it was a recommended place to go for installation instructions.

I followed the instructions above in conjunction with your rails install on leopard instructions (http://hivelogic.com/articles/ruby-rails-leopard/)

I was trying to create a basic 'hello world' program. I created a controller and an .rhtml file for it to goto. When I tried to run it all local on my machine I got an error message referencing sqlite3.

Do you think that I may have made an error somewhere down the line and my computer is trying to use sqlite instead of the home rolled mysql above?

I thought maybe I hadnt had it started, so I typed in the line you mention to manually start it in the terminal and it noted it was already loaded.

Thanks

Attila Györffy ·

@John and others:

I just bought my new MacBook, followed the instructions on this page, and I got the same problem when I wanted to start MySQL:

Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’

Since MySQL wants to create a socket as /tmp/mysql.sock and in the tutorial we are adding permissions for the mysql user to the ./var directory, MySQL does not get permissions to its correct socket. MAKE SURE YOU ADD PERMISSIONS TO THE RIGHT SOCKET FILE:

sudo chown -R mysql /tmp/mysql.sock

Hope this is helpful for many people.

PS: Awesome tutorial, keep up the good work

Marcello ·

@Chris,

there is actually a typo in the article, the correct command to issue is "mysql -u root", that is, "u" and "root" are separated.

Life, it is a Travesty&#8230; &raquo; links for 2008-03-20 ·

[...] Hivelogic: Installing MySQL on Mac OS X (tags: installation mysql osx) [...]

Peter ·

PLEASE, don't encourage people to use -O3. GCC generates buggy code in -O3, and has for years. In fact, there is no need to set custom CFLAGS, LFLAGS or CC variables. Let the system choose its own optimizations.

Patrick ·

Hi,
How to find a good direction when everyone has the same problem, I mean ERROR 2002 with mysql[any version], and that everyone has his own solution! In which directory this famous /tmp is located? Is it in /usr/local? Why those in charge with this program do not keep standards regarding maintenance and support?

Disturbing and tiring. I wondered if someone knows how installing Ruby on Rails inside MAMP Pro, because at this time, it's the best software for Mac users.

Regards
Patrick

patrick elder &raquo; Blog Archive &raquo; Installing MySql on Mac OS X ·

[...] Great “how-to” to install mysql on Mac OS X without a single problem.http://hivelogic.com/articles/installing-mysql-on-mac-os-x/  [...]

Nelz ·

Hello. Thanks for the article.

For me, the launchd config specified here didn't seem to work... If the same problem happens for you, try this: http://blog.tomatocheese.com/archives/2007/11/1/migrating_mysql_to_mac_os_x_leopard/

6-4 Dumb Man &raquo; Ask TUAW: Migration questions, saving disk space, making audiobooks and more ·

[...] have a question regarding the Terminal and a MySQL installation. I followed the great tutorial at HiveLogic, everything installed fine and I didn’t have any problems with the paths whatsoever [...]

Tim DeMoss ·

Hi. Great article Dan.

I have been trying to get MySQL installed on my Mac for nearly six years (off and on). This tutorial and the comments have finally got me up and going. One additional piece of information to add for those having mysql.sock problems: if you have a symbolic link configured on your system for the directory that holds mysql.sock, you will need to set your socket path using the actual path -- do not use the link. At least that's the way it was on my system.

My /tmp directory was actually a link to /private/tmp, so I had to use the following in php.ini:

mysql.default_socket = /private/tmp/mysql.sock

and this in my.cnf:

socket=/private/tmp/mysql.sock

By the way, a small but important difference I had that you may have as well -- my.cnf was actually named .my.cnf and was located in my home directory.

Once I had those config values set, I restarted Apache (sudo apachectl restart) and used the following to start up the mysql daemon:

sudo /usr/local/mysql/bin/mysqld_safe --socket=/private/tmp/mysql.sock --user=mysql &

Can't tell you how excited I am to see "mysqld" in my process monitor after six years of trying! Thanks to everyone who contributed their experience and knowledge.

Chris ·

Having the same problem as everyone else... after typing 'mysql -uroot' i get:

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

It's very frustrating...

Marc Axler ·

What happens if I mistype something during the steps? There seems to be very little room for error! I made a mistake (before the "make" command and find now that I can no longer issue the curl command. It doesn't download the gz file anymore. HELP!!!

Marc Axler ·

Disregard my last post. Needed to exit terminal and go back in. Just finished installing everything!

Ant the democratic movement &raquo; Blog Archive &raquo; Ask TUAW: Migration questions, saving disk space, making audiobooks and more ·

[...] have a question regarding the Terminal and a MySQL installation. I followed the great tutorial at HiveLogic, everything installed fine and I didn’t have any problems with the paths whatsoever [...]

jorge ·

I'm going to try try installing now, but I'm a bit worried about all the 'error 2002' problems in the comments.

jorge ·

Well, several hours later. I followed the instructions to the letter, and got the same error as everyone else, "ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)"

IF YOU WANT MYSQL ON YOUR MAC DO NOT FOLLOW THE INSTRUCTIONS IN THIS POST, SINCE THEY DON'T WORK!

Heinz Muller ·

I have problem which is same as other. The Error 2002. Have anyone solution? Many people must have suffer because this.

wess ·

Try starting mysql without using launchd.
just:
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &

.. close the window.
open a new one and run: ps aux | grep mysql
you should see the process.

then try: mysql -uroot
(add -pPassword if you set one)

hope this helps. I got that error too. Thats how I got past it.

Peace.
Wess

caruso_g ·

Hi Dan,
thanks a lot for the article, the time and the effort to write it.
But… would you, please, when you can, answer us about the *funny*
“ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)” ?
A lot of us are experiencing this problem which makes the article, even if technically useful, totally and practically useless.
Thanks for your time in answering us.

Combo Pack: CakePHP and Leopard Virtual Hosts | GiveGoodWeb ·

[...] directory (~/Sites). If you haven’t already done so, install MySQL - I followed these directions with a strong cup of coffee and got it [...]

Michael ·

I finally found out that OS X sucks bigtime! If this is what it takes to make Mysql work on a Mac its madness! On a winsucks box you simply click install as a service, and it works! This is NO GOOD!

Elle ·

This is the third tutorial by Dan that I followed and as usual, very informative and useful. Thank you.
However, I had a problem with CocaoMySQL that I couldn't connect. I then set:
> SET PASSWORD FOR 'some_user'@'some_host' = OLD_PASSWORD('newpwd');

...and am able login to CocoaMySQL but I still have problems accessing any of my databases.

On http://dev.mysql.com/doc/refman/5.0/en/old-client.html it says:
Tell the server to use the older password hashing algorithm:

1. Start mysqld with the --old-passwords option.

... but I'm not sure how to define this with the manual stop/start method in this article.

Or would I have a problem with my privileges?
I don't have a problem accessing my databases using PHPmyAdmin.

Can anyone help, please?
Thanks,
Elle

Julian ·

13 April 2008 --
I second the additional steps below: -- for some reason the mysql client process (launched when typing 'mysql') is looking in /tmp for a file called mysql.sock and mysqld is storing it in /var/mysql/mysql.sock. The instructions below seemed to work for me in that the 'ERROR 2002 (HY000)'goes away.

sudo /usr/local/mysql/bin/safe_mysqld
sudo mkdir /var/mysql/
sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock

Chris ·

I think I've solved my prior "ERROR 1045 (28000): Access denied for user ‘root’@'localhost’ (using password: NO)" issues. I enabled root user via directory access and reinstalled following the steps in the article.

Mysql started up fine after that. Now I'll see how it works with rails.

installing mysql on linux ·

Very nice and simple tutorial, Thanks for sharing

David Cohn ·

I'm a total Noob - and I'm pulling my freak'n hair out over here. Somebody please help me. I just want to get started. AHHHH.

So everything was going fine until I got to that .plist stuff.
when I run the following line I get the following response.

Line: sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist

response: david-cohns-macbook-pro:mysql davidcohn$ sudo launchctl load -w /Library/LaunchDaemons/com.mysql.mysqld.plist
launchctl: propertyList is NULL
launchctl: no plist was returned for: /Library/LaunchDaemons/com.mysql.mysqld.plist
launchctl: no plist was returned for: /Library/LaunchDaemons/com.mysql.mysqld.plist
nothing found to load

I'm getting super annoyed. I created the .plist file using textmate - saved it to the desktop then followed the lines directly after that. In the actual LaunchDaemons folder, however, I am unable to even open the .plist file manually. It says "this document "com.mysql.mysqld.plist" cannot be opened.

grrrrrr.

I also, just for the heck of it, saved the document as a .plist.txt file - then when it was in the library folder I could open it - but I still got the bad response.

I hope people can feel my frustration and throw me a bone. I'm not a programmer - but I want to learn.

p.s. anyone in the bay area that helps me install mysql gets a free dinner on me.

sw0rdfish ·

Hey David, I had the same problem with TextMate... the problem is the < should be < and the > should be >





KeepAlive

Label
com.mysql.mysqld
Program
/usr/local/mysql/bin/mysqld_safe
RunAtLoad

UserName
mysql
WorkingDirectory
/usr/local/mysql


is what is should look like... I don't know if these comment sections are gonna edit the code I just posted,... but drop me an email and I'll send it to you if you can't figure it out... basically just run a find and replace and it should work.

Per Hamrin ·

Hi I also struggled with the .plist error.
The solution is as stated above that the codebox with the plist code replaced the brackets, <>, with their code representation here separated by spaces to avoid same thing in this post

it should be

(pointy bracket) text (ending pointy bracket)
instead of:
(& l t ) text (& g t)

as stated in the codebox for me atleast. It might have something to do with my brower or something but when i fixed my .plist file the common socket(2) error also dissapeared.
just my 2 cent:
Great job on the article btw!
really helped me ALOT!

mr.soul ·

can we get an update of this tutorial with the bugs worked out? i'm reading that there are mistakes in the steps, various error codes, this, that and the other. for those of us who aren't programming experts, this can be very confusing.

has anyone found a FOOLPROOF method to installing??? where the steps work and include any possible errors? it's hard going back and forth make changes to code lines when u're not really aware of what you're doing....i've been working on this for days now, and although close...no cigars.

Rolando ·

Per Hamrin,

Thank you for elaborating on sw0rdfish's post. Changing the contents of the plist so that they use actual "pointy braces" fixed the issue. Before this, launchctl returnedothing found".
(I am running a fresh Macbook Pro on OSX 10.5.2, just purchased yesterday).

eric ·

The shell script is for intel machines only. If you want the shell script to work for ppc you have change the 'i386' to 'PPC'.

Also, I noticed a discrepancy between the shell script and the detailed instructions. In the shell script it says:
--enable-local-infile --disable-shared

while the detailed instructions say:
--enable-local-infile --enable-shared

shecky ·

Dan/Anyone:

I've previously followed these instructions with success (on my G5, running Tiger) to the letter with success but this evening I tried to do the same on my MBP (also running Tiger) and something is seriously not happening.

When I get to this step:

CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql \
--with-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile --enable-shared

... I presumed that a 'return' stomp was required after each line is pasted into Terminal; when doing so, Terminal did not return to the bash (terminology?) prompt, i.e., ~shecky$. On one of several attempts, I figured I'd just go ahead and paste them all in - hitting 'return' after each - and see what would happen. After the last line, Terminal ran off a few zillion lines and then this:

MySQL has a Web site at http://www.mysql.com/ which carries details on the latest release, upcoming features, and other information to make your work or play with MySQL more productive. There you can also find information about mailing lists for MySQL discussion.

Remember to check the platform specific part of the reference manual for hints about installing MySQL on your platform. Also have a look at the files in the Docs directory.

Thank you for choosing MySQL!

... which has a certain 'something succeeded' kind of vibe to it, so I then proceeded with the 'make' command but encountered the following error:

[me]:~/src/mysql-5.0.45 sr$ make
make: *** No targets. Stop.

Dan? Anyone? Bueller?

no more hair to pull out ...

Jeff Webb ·

Dan,

Great article - I've used this and the ruby/rails article many times to find my inner *nix geek.

I would recommend installing mysql to a version-numbered directory and creating a symbolic link for /usr/local/mysql pointing to that location. You can then install multiple versions of mysql in case you want to jump around from version to version. You also won't have your data wiped if you install another version (although you will have to either copy data directories or point to a common location).

I converted the configuration to:

CC=gcc CFLAGS="-O3 -fno-omit-frame-pointer" CXX=gcc \
CXXFLAGS="-O3 -fno-omit-frame-pointer -felide-constructors \
-fno-exceptions -fno-rtti" \
./configure --prefix=/usr/local/mysql \
--with-extra-charsets=complex --enable-thread-safe-client \
--enable-local-infile --enable-shared

After doing the install and before creating the mysql DB I add this line:

sudo ln -s /usr/local/mysql-5.0.45 /usr/local/mysql

This way I can install 5.0.45 to get around the "infile bug fix" in 5.0.51!

Thanks again.

Jeff

Jeff Webb ·

@eric

From the MySQL documentation, it does not look like a serious issue to go with either --enable-shared or --disable-shared:

http://dev.mysql.com/doc/refman/5.0/en/configure-options.html

If the build fails and produces errors about your compiler or linker not being able to create the shared library libmysqlclient.so.N (where N is a version number), you can work around this problem by giving the --disable-shared option to configure. In this case, configure does not build a shared libmysqlclient.so.N library.

Yves Page ·

Hi,

Excellent article ! Everything worked as advertised (on Leopard).

Thank You
Yves

Martin ·

Yeah !!!

People like you make the world much more easy!!!!

Thanks for this perfect tutorial

(did it in less than 20 min)

Don ·

I'm trying this on leopard and cannot get it too work, I've tried redownloading and removing about 10 times went with an installer and still I can't get mysql to work correctly!
I keep getting this error everytime I try to create or access a database:

'Can't connect to local MySQL server through socket '/tmp/mysql.sock'

I've googled the hell out of it and noone has a solution that has worked for me! I'm sure I'm not the only one with this issue. I've cut and pasted all the steps to make sure I didn't type wrong. I have not used mysql on this machine before, only on window prior to my switching a few months back so anyhelp is greatly appreciated!

Also I've tried using sudo and still the same error.

Thanks for anything in advance! Please save me before I pull the rest of my hair out!

D

Ian ·

tried this install on Leopard (10.5.2) and it worked like a charm. Also fixed a nasty little bug that was stopping me from installing perl DBD::mysql using the pre-compiled binary mysql.

Pierre R ·

I was also getting the mysql.sock error... it only started happening after I installed MAMP on my system. Apparently, MAMP puts the mysql.sock file in a different location. To solve it, I ran this command in terminal:

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

For more information, read: http://www.fischerlaender.net/apple-mac/mac-os-x-trouble-with-mamp-mysql

Thanks to Dan for this great tutorial!

Blunda ·

I get as far as confirming the server started, and then things go south.

I type in "mysql -uroot" to confirm mysql is working.

I get this in return, after waiting a few minutes:

"Workaround Bonjour: Unknown error: 0"

The directions say to start over and do it again, but I've done it twice now with no issues.

How do I get around this?

Martin Schröter ·

Hey, once again: Thanks for this great Tutorial.
I prefer starting MySQL manally. But because I'm too lazy to type commands to the Terminal I made as mall GUI which shall handle this for me. It's absolutely simple but it does it for me.
You can load it here
But I don't know if it runs accurate on any machine- otherwise you have to change the code, which is available there, too.

Don ·

Thanks Pierre for this:

sudo ln -s /Applications/MAMP/tmp/mysql/mysql.sock /tmp/mysql.sock

but it didn't work either. Does anyone else have any ideas?

D

roberta ·

your tutorial is pretty clear, but I have encountered two problems:
1. . ~/.bash_login (I cannot execute this command, message error:-bash: .~/.bash_login: No such file or directory)
2. when starting mysql, I've got the error:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

very, very frustrating!!!

ScottBruin ·

Possible solution to MySQL (ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)) error:

I think this problem generally comes about from a previous installation of MAMP or MySQL. I opened up Activity Monitor, made sure I was viewing "All Process" from the drop down, and Force Quit anything with "mysql" in the title. After that I tried "mysql -uroot." First time it didn't work but did it again and it worked. Looking in /tmp/ there is now a mysql.sock file.

Hope that helps someone.

PS Make sure MAMP is stopped. And get rid of it, it's crap.

Martin Schröter ·

=> To roberta:

I had the same Problem. I f you can't open the bash-login file then it's because it doesn't exist. It's easy to solve: just make this file:

$pico .bash_login [Enter]

Then pico makes this file and opens it.
You then have to enter the Path, like Dan showed in his tutorial

Then save it with pico [ctrl + x, when pico askes to save just say yes with Y]

Then the second problem you have should be fixed, too.

fear ·

thanks for the tut but please help, it's driving me crazy the socket problem, I see that is frequently, what's going on?
is the way that we start our server not good? or from the installation?
i've read in other articles and replace the mysql.sock but i get the same problem but with (62) at the end
please help

Seve R. ·

Thanks so much - this worked like a charm on an iMac PPC G5.

One addition: when compile and setup is done, where you wrote to type:
"mysql -uroot"

I got the following error:
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

I had to do a couple of extra things to get this to work:

1. mysqladmin -u root password=
2. mysql -u root -p
3. When prompted, input password from #2.

Easy fix, but can be a PITA for a newbie.

Thanks again!

SR

Steve R. ·

@fear

I've run into your issue - may be a daemon problem (something not running). The MySQL website discussions can help, I would try there. I can't locate the resolution I identified a while back, sorry, or I'd post it, but it is a common problem, and IIRC it is a relatively easy fix.

Steve R. ·

@my earlier comment...

Sorry, part of my comment got stripped.

line 1 should read:

mysqladmin -u root password=whatever-password-you-want-to-assign

Sorry, brackets got filtered out.

SR

Chris ·

Hello, I am having a gcc compiling problem - "checking for C compiler default output file name... configure: error: C compiler cannot create executables
See config.log' for more details."

When Checking the config.log, I see the following:

-----
configure:3715: $? = 0
configure:3717: gcc -v &5
Using built-in specs.
Target: powerpc-apple-darwin8
Configured with: /var/tmp/gcc/gcc-5370~2/src/configure --disable-checking -enable-werror --prefix=/usr --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-transform-name=/^[cg][^.-]*$/s/$/-4.0/ --with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib --build=powerpc-apple-darwin8 --host=powerpc-apple-darwin8 --target=powerpc-apple-darwin8
Thread model: posix
gcc version 4.0.1 (Apple Computer, Inc. build 5370)
configure:3720: $? = 0
configure:3722: gcc -V &5
gcc: argument to `-V' is missing
configure:3725: $? = 1
configure:3748: checking for C compiler default output file name
configure:3751: gcc -O3 -fno-omit-frame-pointer conftest.c >&5
/usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: /usr/lib/gcc/powerpc-apple-darwin8/4.0.1/../../../libSystem.dylib unknown flags (type) of section 9 (__TEXT,__dof_plockstat) in load command 0
collect2: ld returned 1 exit status
configure:3754: $? = 1
configure: failed program was:
| /* confdefs.h. */
....
----

Anyone have an idea as to how to correct? Any help will be appreciated. Incidentally, my install of dev tools is 3.0.

Thanks in advance,
Chris

Timmy ·

http://www.google.com >google
http://www.test.com >test
http://www.google.com >google
http://www.test.com >test

Betsy ·

Anyone else having this problem?

I successfully complete steps up to (and including)
sudo ./bin/mysql_install_db --user=mysql

but when I try to run:
sudo chown -R mysql ./var
I get a ./var: No such file or directory.

roberta ·

OK, here is the solution for those getting:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Basically, you have to install MySQL.prefPane file, so that your computer can act as a server. You can find the file to install within the Mysql installation files (package format)

Davin ·

hello,

sorry if this has already been addressed in the comments... it's a lot to sift through:

last time i installed MySQL it completely killed my calendar, has anyone ever come across this problem?

i really need sql on my system but am a little scared to install for want of maintaining my ical

thanks,

anonymous ·

Got the "Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)" error.

Changed the permissions on /tmp/mysql.sock via

sudo chown -R mysql /tmp/mysql.sock

Everything appears to be operating within established parameters.

Great article.

Markus Lucassen ·

Hy guys,

I've installed latest MySQL version 5.1.24-rc (Source) and compiled it sucessfully.

BUT when I start "mysql" I'll get the error "ERROR 1045 (28000): Access denied for user 'lulu'@'localhost' (using password: NO)". Starting mysql with "mysql -u root -p" and entered my root password I'll get the same error "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)".

Do you've got an idea what has been went wrong?
I'm using Mac OS X 10.5.2 all patches installed and latest MySQL version (above error occured on both installations the Source and the DMG one)

THANKS for any suggestion/hint
Markus

Ben ·

Gosh, what a star. Got me completely sorted on my PPC computer running Leopard. Massively appreciated...

Kevin Rodgers ·

> You’ll have a stand-alone, easy-to-update version of MySQL that you control and understand

What is the easy-to-update process?

jeff ·

Markus-

I am having the same problem - did you ever resolve? thanks!

Xavi ·

Wow!! great article!!

Wtih that clear explanations, my Macbook runs mysql at the first atempt!!

Thanks Dan.

Andrea Zabaznoska ·

hey hey!

Great article! MySQL is running on my Mac :D

Arik Jones ·

Wow... Thanks again! This is a great write-up and stands the test of time (mostly). lol.

ronan ·

thanks a lot for this handy tutorial!

William Kanoff ·

In installing mysql 5.0.45 on a Quicksilver 2002 (800) under OS X 10.4.11 no var directory is created, instead a data directory is created. If you try to start you will get the following:

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

Change /data/ to/ var/ then change the owner and group to mysql. You will then be able to start up with mysqladmin and set the password for root user.

mysqladmin -u root password 'new password'

Then you can log in.

aharl ·

I'm getting this error after the sudo make install command

make install-recursive
Making install in .
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
Making install in include
make install-am
make[4]: Nothing to be done for `install-exec-am'.
test -z "/usr/local/mysql/include/mysql" || /Users/andy/src/mysql-5.0.45/install-sh -d "/usr/local/mysql/include/mysql"
mkdir: /usr/local/mysql: File exists
make[4]: *** [install-pkgincludeHEADERS] Error 1
make[3]: *** [install-am] Error 2
make[2]: *** [install] Error 2
make[1]: *** [install-recursive] Error 1
make: *** [install] Error 2

I also see this at the end of the make command

make[3]: Nothing to be done for `all-am'.

I'm currently trying to install 5.0.45 on 10.5.4

any help would be much appreciated.

Michael Whittaker ·

thanks a lot! reinstalled leopard and thanks to your article I have a bleeding-edge and clean mysql daemon running :)

Benjamin ·

PERFECT!

.. the current installer package didn´t work for me, somehow even mysqladmin could not connect to mysql ...

But with this tutorial i finally got it running (-: and did by the way my first compiling (-:

BIG THX
Benjamin
(Mac Pro early 2008 with 10.5.4)

·

Thank you sir!

Kate Schmidgall ·

I am on Mac OSX (10.5.4)...

I am going through the steps as you've laid them out (very nicely, thank you!!) but when I try to execute this step:

"You then need to configure MySQL:"

I keep getting this error:

"-bash: ./configure: No such file or directory"

I have tried a bunch of different things, but really I have no idea how to get this right...help anyone??

Brian Hutchison ·

aharl: I am having the same problem. These steps worked for me before.

Nathan ·

When I tried to setup the initial databases and privileges I got the following errors. I followed the steps very closely and every other command work well. I'm installing on a mac-mini 10.4.7

sudo ./bin/mysql_install_db --user=mysql

chown: mysql: Invalid argument
Installing MySQL system tables...
080728 16:05:07 [Warning] Setting lower_case_table_names=2 because file system for /usr/local/mysql/var/ is case insensitive
080728 16:05:07 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!

080728 16:05:07 [ERROR] Aborting

080728 16:05:07 [Note] /usr/local/mysql/libexec/mysqld: Shutdown complete

Installation of system tables failed!

problem ·

I am trying to install a new mysql on my macosx server, and i got to the "make" and when i typed it igot this message;

command not found;

here is what i got when i entered the lines previous

hecking "character sets"... default: latin1, collation: latin1_swedish_ci; compiled in: latin1 latin1 utf8 big5 cp1250 cp932 eucjpms euckr gb2312 gbk latin1 latin2 sjis tis620 ucs2 ujis utf8
checking whether to compile national Unicode collations... yes
checking whether build environment is sane... yes
checking whether make sets $(MAKE)... (cached) no
checking for gawk... (cached) awk
checking for gcc... gcc
checking for C compiler default output file name... configure: error: C compiler cannot create executables
See `config.log' for more details.
sh-3.2# make
sh: make: command not found

problem ·

Nevermind - needed to install Xtools, I assumed ServerX had it already

Richard Henry ·

Dan

I would be very interested in a building PHP on Leopard tutorial! Just thought I'd chip in and vote.

Excellent tutorial, extremely well written.

Richard

TechnoBuddhist ·

Brilliant, thank you!!! But I did get 2 of the problems ppl are having above and have got them fixed/worked around. For what it's worth to ppl here's how I managed to get around both of the following problems;
I downloaded and installed MySQL Administrator when getting these 2 errors.

1. Can't connect because of the /tmp/mysql.sock problem
I clicked the little triangle next to the "More Options:" option on the MySQL Administrator login screen and used:
'Connect Using Socket': /var/mysql/mysql.sock

2. Access denied for user 'root'@'localhost' (using password: YES)"
When logging into MySQL administrator DON'T use a password;
'Username': root
'Password':

Obviously if you gave root a password then this won't help!

good luck everybody

Joe Mesot ·

Ok, I am totally new to Mac, Unix, and MySQL. This tutorial is by far the best one that I have seen for using the CLI to install MySQL. It makes sense of really confusing stuff. Thanks for putting it together.

Now, on to my problem... I REALLY REALLY REALLY want to get this running. I have a G5 MacPro with Leopard 10.5.3, 1TB hard disk, 2 GB of ram, dual 2.7 GHz Power PC processors. I tried to install a binary dist. of MySQL (5.5.51b-osx-10.5-x86) only to find out that that binary was for the intel processor based Macs. So:

1) Is it possible to get rid of this install? and 1a) how?

2) I followed all of the instructions listed here to the letter. I go rid of the older version directory (sudo rm /usr/local/mysql), then went on to download the source file (curl -0 http://mysql.he.net/Downloads/MySQL-5.0/mysql-5.0.45.tar.gz) into the ~/src folder. Terminal began peeping methodically while displaying something that looked like the code from "The Matrix" without the green color to it. Then it gets to the end of that (I think), or rather it just stops, and outputs this:

sc1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c;1;1;112;112;1;0x1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c;1;1;112;112;1;0x1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;2c1;

My only option from there is to press the 'return' key which cause it to output this:

-bash: 1: command not found
-bash: 2c: command not found
-bash: 1: command not found
-bash: 1: command not found
-bash: 112: command not found
-bash: 112: command not found
-bash: 1: command not found
-bash: 0x1: command not found
-bash: 2c1: command not found
and then it repeats the last line about a thousand times and gives a new command prompt.

So, as much I like what I have read IN this tutorial, I have yet to actually complete it. So if there is still anyone monitoring this PLEASE HELP! I'"VE FALLEN, AND I CAN'T GET UP!!!!!!

Your assistance is enormously appreciated.
Sincerely, Joe Mesot.

Joe Mesot ·

Sorry, I got it...

I just copied and pasted the CL form this we page to my terminal window and it worked fine.

Sorry.
(Joe)grinch:"I'm an idiot!"
echo:"You're an idiot!!"

Doug Scott ·

This article has been my go-to across Tiger and Leopard, and apparently it is the same for others. I've seen it referenced numerous times in gospel-invoking tones for a problem I've been tearing my hair out over, and for good reason - the instructions are pretty much bullet proof. Except in this one instance.

Problem: Post-install I have been unable to invoke interactive Ruby either by $>IRB or $>ruby script/console. I immediately return back to the shell with:

dougscott$ irb
dyld: NSLinkModule() error
dyld: Symbol not found: _rl_filename_completion_function
Referenced from: /usr/local/lib/ruby/1.8/i686-darwin9.2.2/readline.bundle
Expected in: flat namespace

Trace/BPT trap

I noticed that the pre-Leopard version of these instructions had a pre-install of GNU readline, now absent from the Leopard instructions, but heck it was different so I messed around with that for quite a while, compiling 5.1 and 5.2, updating a shobj.conf file to detect Leopard correctly (which is a problem (if you really need to compile new readline source (which you don't))).

Lots of life passed by and nothing worked. I really wanted to feed Ruby examples into the interactive console, so finally, via extended application of much google-fu, I found this spot-on answer at:

http://www.ruby-forum.com/topic/83481#148701

Which I'll quote just in case it ever goes away. According to Erik J. Barzeski:

I'm fairly confident I've solved the prob