0
gal-harths-iMac:~ galharth$ ruby -v
-bash: ruby: command not found
gal-harths-iMac:~ galharth$ open -e .bash_profile
-bash: open: command not found

what shoud i do?

my .bash_profile and .profile and .bashrc are empty, i need to write something in them?..

2
  • It would help if you added a description of what you had been trying to do. By default you should have had ~/.bashrc or ~/.bash_profile, and your path should have been defined allowing ruby to be found. Ruby is installed by default on Mac OS, but needs to be left alone as Apple has applications that use it. If you are installing Ruby, use RVM to manage everything in a sandbox. Feb 9, 2011 at 15:10
  • @tin man is right. you don't need anything in your bash files, you can extend the default bash settings by editing them, but they should be blank unless you need something special Feb 9, 2011 at 18:23

6 Answers 6

4

I suspect that you have something overriding your default path (like .bash_profile or .bashrc) open is a valid command on os x, for me man open returns

NAME
     open -- open files and directories

SYNOPSIS
     open [-e] [-t] [-f] [-W] [-R] [-n] [-g] [-h] [-b bundle_identifier]
          [-a application] file ... [--args arg1 ...]

DESCRIPTION
     The open command opens a file (or a directory or URL), just as if you had
     double-clicked the file's icon. If no application name is specified, the
     default application as determined via LaunchServices is used to open the
     specified files.....

Likewise it is possible ruby is installed but not on the path. My best guess would be to delete or rename your .bashrc and .bash_profile files and log off as that user and log back in, to reset your bash session.

To test if it is a user level issue, create a new account under system preferences -> accounts and then log in as that user, open a terminal and type ruby -v or man open, etc to see if you can do it on a default user account. If that works, it is most certainly some bash settings you have customized in your 'gal-harth' account.

4
  • this is what i get when i type "man open": gal-harths-iMac:~ galharth$ man open -bash: man: command not found
    – gal
    Feb 9, 2011 at 14:37
  • how can i create new account? or customize my gal-harth account bash settings?
    – gal
    Feb 9, 2011 at 14:38
  • i created a new account and there all worked wall.. so how i can change my bash settings? i need to write in the .bash_profile something?
    – gal
    Feb 9, 2011 at 14:48
  • Either type, or put this in your ~/.bashrc : export set PATH=/bin:/sbin:/usr/bin:/usr/sbin Feb 9, 2011 at 16:37
2

The first step to figuring out what's gone wrong is to see what your current PATH is.

echo $PATH

If that returns a blank line, something has gone horribly wrong. You can fix it temporarily by running:

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

And that should get you ruby, as well as open, and man, and a bunch of other commands.

The thing is, the PATH says “Look in these directories for binary files” and not “Here is an explicit list of binary files I want to use.”

0

Ruby is not installed. You need to install it from their website here. Similarly, "open" is not any bash command I've ever heard of.

Upon further reflection, are you trying to install rvm?

2
  • i installed ruby.. its worked me before - ruby -v and open command.. i think i mistaked deleted the .bash_profile or .profile
    – gal
    Feb 9, 2011 at 14:32
  • Ruby is installed by Mac OS and is used by the system, and should NOT be modified by a user. It is OK to install a new version into /usr/local, which is the default for installing from source. A better solution for most users is to use RVM. Feb 9, 2011 at 15:06
0

If you have already installed Ruby, is its location already set in your PATH variable? If not, you can add it to your .bash_profile like this:

echo 'export PATH=/wherever/ruby/is/located:$PATH' >> ~/.bash_profile
0
0

Something is screwing up your PATH -- you shouldn't need to have a .profile (or any of its variants) to have the default PATH set properly. Generally, when the PATH gets screwed up, it's because it's being set wrong in one of the various profile files. When you say .bash_profile and .profile and .bashrc are empty, do you mean they exist but don't have anything in them, or they don't exist at all? Also, do you have a .bash_login or .bashrc file?

I'd take a closer look around your home directory. Use /bin/ls -ld ~/.* to list all of the invisible files in your home directory, and look for anything with "sh", "profile", or "rc" in the name. Also, run /usr/bin/grep PATH ~/.* to see if any of the invisible files mention PATH -- if any do, they're likely suspects.

-2

just type bash_filename or ./_filename

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.