Os x / mysql : install 1.8 : ruby = nil

I’m trying to install ruby/eruby and mysql to learn ruby for web stuff
on os x 10.2

At some point, i think while installing,
http://www.tmtm.org/ruby/mysql/README_en.html , i wacked my ruby
install that comes with os x(my fault, not the above)… i tried to
install in /usr/bin/ruby… then when i noticed that the mysql file
WAS /usr/bin/ruby…dont laugh, i’m new to this :wink:

So i went about getting 1.8. I ran the config…no c compiler so i
loaded the dev tools and ran
…/configure
make
make install
using the defaults…everything seemed ok. But i still have no ruby. I
went into what seems like the install directory /usr/local/bin and try
to run ruby(it’s in there) but i get ‘command not found’.

when i do a ‘whereis ruby’ on the command line i get nothing. ‘which
ruby’ nada. I tried adding ruby to my path…/usr/local/bin

I’d really like to check ruby out. Anyone know of an isp who supports
ruby with mysql/eruby/mod_ruby?

somebody please clue me :wink:

When Apple installs ruby, they install it in /usr/bin and put the
libraries in /usr/lib. I haven’t bothered to take the time to figure
out how to configure ruby to install in the same locations that Mac OS
X installs them by default.

When you build ruby 1.8 from source, as you have seen, it goes to
/usr/local/bin. Since you’ve built it from source, you should be able
to run it by using “/usr/local/bin/ruby somefile.rb” (where somefile.rb
is the script you want to run)

To execute it without having to type the full path name you will have
to add /usr/local/bin to your “path”. Doing so is very “unix geeky”
if you are using the “tcsh” shell (which is the default shell that Mac
OS X sets up when you first install it) then you should be able to
alter your “.tcshrc” file in your home directory with the following
command:

echo “setenv PATH ${PATH}:/usr/local/bin” >> ~/.tcshrc

After you do that issue the following 2 commands

source ~/.tcshrc
rehash

At that point you should be able to just use “ruby somefile.rb”. Since
you’ve changed the path in your .tcshrc it should work every time you
start a new terminal from that point on.

BTW when you changed your current directory to /usr/local/bin and tried
to run ruby and got a “command could not be found” error, it was
because the command could not be found in your path. if you want to cd
to /usr/local/bin and run ruby you could issue the cd command and then
type “./ruby”. That means, run the ruby that is in the current
directory.

Scott

···

On Wednesday, August 27, 2003, at 04:32 PM, paul vudmaska wrote:

I’m trying to install ruby/eruby and mysql to learn ruby for web stuff
on os x 10.2

At some point, i think while installing,
http://www.tmtm.org/ruby/mysql/README_en.html , i wacked my ruby
install that comes with os x(my fault, not the above)… i tried to
install in /usr/bin/ruby… then when i noticed that the mysql file
WAS /usr/bin/ruby…dont laugh, i’m new to this :wink:

So i went about getting 1.8. I ran the config…no c compiler so i
loaded the dev tools and ran
…/configure
make
make install
using the defaults…everything seemed ok. But i still have no ruby. I
went into what seems like the install directory /usr/local/bin and try
to run ruby(it’s in there) but i get ‘command not found’.

when i do a ‘whereis ruby’ on the command line i get nothing. ‘which
ruby’ nada. I tried adding ruby to my path…/usr/local/bin

I’d really like to check ruby out. Anyone know of an isp who supports
ruby with mysql/eruby/mod_ruby?

somebody please clue me :wink:

I’m trying to install ruby/eruby and mysql to learn ruby for web stuff
on os x 10.2

At some point, i think while installing,
http://www.tmtm.org/ruby/mysql/README_en.html , i wacked my ruby
install that comes with os x(my fault, not the above)… i tried to
install in /usr/bin/ruby… then when i noticed that the mysql file
WAS /usr/bin/ruby…dont laugh, i’m new to this :wink:

So i went about getting 1.8. I ran the config…no c compiler so i
loaded the dev tools and ran
./configure
make
make install
using the defaults…everything seemed ok. But i still have no ruby. I
went into what seems like the install directory /usr/local/bin and try
to run ruby(it’s in there) but i get ‘command not found’.

this is probably because ‘./’ (the current directory) is not in your PATH.

what does this output?

/usr/local/bin/ruby

when i do a ‘whereis ruby’ on the command line i get nothing. ‘which
ruby’ nada. I tried adding ruby to my path…/usr/local/bin

hmmm - can you show the output of your commands? if running bash(sh, maybe
even tcsh) try:

env PATH=/usr/local/bin which ruby

I’d really like to check ruby out. Anyone know of an isp who supports
ruby with mysql/eruby/mod_ruby?

somebody please clue me :wink:

can’t help you there…

-a

···

On Wed, 27 Aug 2003, paul vudmaska wrote:

Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
~ > ruby -e ‘p(%.\x2d\x29…intern)’
====================================

Thank you both for your great help - with it i’ve manage to get ruby
to run from the console and access mysql!

My system seems a litte yest as whereis still does not work. Here is
the output from terminal, -tcsh
(I hear apple is switching to bash- maybe i should?)

[paul-vudmaskas-Computer:~] paulvudm% env PATH=/usr/local/bin which
ruby
env: which: No such file or directory
[paul-vudmaskas-Computer:~] paulvudm% which ruby
/usr/local/bin/ruby
[paul-vudmaskas-Computer:~] paulvudm% whereis ruby
[paul-vudmaskas-Computer:~] paulvudm% which ruby
/usr/local/bin/ruby
[paul-vudmaskas-Computer:~] paulvudm% whereis ruby
[paul-vudmaskas-Computer:~] paulvudm%

I put /usr/local/bin in my path by editing ~/.tcshrc
Did the source comand followed by the rehash.

At least i know its there, thanks to you!

Paul

My system seems a litte yest as whereis still does not work. Here is
the output from terminal, -tcsh
(I hear apple is switching to bash- maybe i should?)

Well… tcsh or bash… you’d still be running the same whereis.

reading the man page for whereis I see:

  The whereis utility checks the standard binary directories for the 

speci-
fied programs, printing out the paths of any it finds.

Since your ruby is not installed in one of the “standard” binary
directories, I suspect whereis can’t find it.

You could create a symbolic link in /usr/bin:

sudo ln -s /usr/local/mysql/ruby /usr/bin/ruby

Then whereis would work as you expect it to.

:slight_smile:

Scott

···

[paul-vudmaskas-Computer:~] paulvudm% env PATH=/usr/local/bin which
ruby
env: which: No such file or directory
[paul-vudmaskas-Computer:~] paulvudm% which ruby
/usr/local/bin/ruby
[paul-vudmaskas-Computer:~] paulvudm% whereis ruby
[paul-vudmaskas-Computer:~] paulvudm% which ruby
/usr/local/bin/ruby
[paul-vudmaskas-Computer:~] paulvudm% whereis ruby
[paul-vudmaskas-Computer:~] paulvudm%

I put /usr/local/bin in my path by editing ~/.tcshrc
Did the source comand followed by the rehash.

At least i know its there, thanks to you!

Paul

You could create a symbolic link in /usr/bin:

sudo ln -s /usr/local/mysql/ruby /usr/bin/ruby

Then whereis would work as you expect it to.

Most cool, so let me make sure i have this correct…

i go to my /usr/bin dir
#>cd /usr/bin

then i execute the command
#>sudo ln -s /usr/local/bin
or is it
#>sudo ln -s /usr/bin /usr/local/bin

So that if /user/bin is searched it might find my ruby1.8 in /usr/local/bin

I’ve screwed up enuf to make sure first!

:stuck_out_tongue:

You could create a symbolic link in /usr/bin:

sudo ln -s /usr/local/mysql/ruby /usr/bin/ruby

Then whereis would work as you expect it to.

Most cool, so let me make sure i have this correct…

i go to my /usr/bin dir
#>cd /usr/bin

then i execute the command
#>sudo ln -s /usr/local/bin
or is it
#>sudo ln -s /usr/bin /usr/local/bin

So that if /user/bin is searched it might find my ruby1.8 in
/usr/local/bin

I’ve screwed up enuf to make sure first!

Don’t try to change the location of /usr/bin!

Just do

sudo ln -s /wereeveryourrubyis/ruby /usr/bin/ruby

That is, create a symbolic link from wherever ruby is into /usr/bin/ruby

Scott

Thanks Scott. i"ll try this when i get back to my mac.

Ok, maybe i’m gettin closer…I did what you suggest…

[paul-vudmaskas-Computer:~] paulvudm% sudo ln -s /usr/local/bin/ruby /usr/bin/ruby Password: [paul-vudmaskas-Computer:~] paulvudm% whereis ruby /usr/bin/ruby [paul-vudmaskas-Computer:~] paulvudm% which ruby /usr/bin/ruby [paul-vudmaskas-Computer:~] paulvudm% sudo ln -s /usr/bin/ruby /usr/local/bin/ruby ln: /usr/local/bin/ruby: File exists [paul-vudmaskas-Computer:~] paulvudm% whereis ruby /usr/bin/ruby [paul-vudmaskas-Computer:~] paulvudm%

Now when i do a where is, instead of blank, i get the original
location, instead of the new. Then i tried switching arround. Think it
would be neat if it pointed to where the current directory. When i do
a ruby call now will it use the second?

I’ve been checking out webrick and erb…finally got my first eruby
page.!

Thanks again for your help.

paul

Now when i do a where is, instead of blank, i get the original
location, instead of the new. Then i tried switching arround. Think it
would be neat if it pointed to where the current directory. When i do
a ruby call now will it use the second?

You’ve created what in UNIX is called a “symbolic link” from
/usr/bin/ruby to /usr/local/bin/ruby. It’s a bit hard to explain
exactly what that means… if you’re familiar with Macintosh “Aliases”
that may be the easiest way to think about it. You created an alias to
/usr/local/bin/ruby and put it in /usr/bin.

For more information your best bet may be to “man ln” and read about
symbolic links. Alternatively you can search the web and learn as much
as you like about them :slight_smile:

Scott