0

I am trying to setup my machine for development and I keep getting the error, -bash: command not found. I am getting while running various commands. I am brand new to this, trying to get into development, and am not sure how to fix it. From what I have read it may have something to do with my PATH. Again, I'm new to this so I really have no clue.

new-host:~ Home$ echo $PATH
/opt/local/bin:/opt/local/sbin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@global/bin:/usr/local/rvm/rubies/ruby-1.9.3-p194/bin:/usr/local/rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/opt/sm/bin:/opt/sm/pkg/active/bin:/opt/sm/pkg/active/sbin

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
ibadukefan
  • 47
  • 1
  • 2
  • 6
  • if you run find / -print | xargs grep bash, what's the output? is that location in your path? – atk Apr 01 '13 at 00:07
  • new-host:~ Home$ find / -print | xargs grep bash find: /.DocumentRevisions-V100: Permission denied find: /.fseventsd: Permission denied find: /.Spotlight-V100: Permission denied find: /.Trashes: Permission denied xargs: grep: Argument list too long – ibadukefan Apr 01 '13 at 00:11
  • Are you getting the message with a dash in front as in the question body, or without the dash as in the title? What is the setting of $SHELL? If it says `/bin/-bash` or `-bash` (with the dash), then reset it without the dash: `SHELL=/bin/bash`. The `-` in front of the name indicates to the shell that it is a login shell and should process `/etc/profile` etc. OTOH, simply setting `SHELL=/bin/-bash` did not routinely cause me problems, even executing plain shell scripts without shebang. – Jonathan Leffler Apr 01 '13 at 00:24
  • I am getting the dash in front. – ibadukefan Apr 01 '13 at 00:45

3 Answers3

0

On OS X, by default, bash should be located as /bin/bash. So if /bin is not in your path then you need to put it there. It sounds like you must have been tweaking the base OS X install considerably. That, or you have installed some packages (macports, fink, brew, etc.???) that have 'adjusted' your path variable, perhaps in undesirable ways.

If you can execute /bin/bash, then you just need to make /bin an entry in your PATH environment variable again. Places to check:

/etc/profile
/etc/bashrc
~/.profile
~/.bashrc
Randy Howard
  • 2,165
  • 16
  • 26
  • new-host:~ Home$ /etc/profile -bash: /etc/profile: Permission denied new-host:~ Home$ /etc/bashrc -bash: /etc/bashrc: Permission denied new-host:~ Home$ ~/.profile -bash: /Users/Home/.profile: No such file or directory new-host:~ Home$ ~/.bashrc -bash: /Users/Home/.bashrc: Permission denied – ibadukefan Apr 01 '13 at 00:15
  • Yes, I was also trying to install macports, brew, etc.. – ibadukefan Apr 01 '13 at 00:16
  • I've used both in the past, without this, but any individual package could have done it. Another useful thing to do is to create a new user login, and see if it works properly there. That'll tell you if you have messed it up system wide, or just in your own login account. – Randy Howard Apr 01 '13 at 00:21
  • I created a new profile, here is the result: – ibadukefan Apr 01 '13 at 00:44
  • new-host:~ dev$ /etc/profile -bash: /etc/profile: Permission denied new-host:~ dev$ /etc/bashrc -bash: /etc/bashrc: Permission denied new-host:~ dev$ ~/.profile -bash: /Users/dev/.profile: No such file or directory new-host:~ dev$ ~/.bashrc -bash: /Users/dev/.bashrc: No such file or directory – ibadukefan Apr 01 '13 at 00:45
  • Have you tried creating another login account yet to test the system path? – Randy Howard Apr 01 '13 at 00:49
  • Yes, that is what I just posted. Same result. – ibadukefan Apr 01 '13 at 00:50
  • Ok, so I wiped my HDD and did a fresh install of 10.8.3. I created a separate profile for development. I typed rvm install 1.9.3 and got... -bash: dvm: command not found – ibadukefan Apr 01 '13 at 18:37
  • @ibadukefan please see my answer. You didn't need to wipe your system... – MattDMo Apr 01 '13 at 20:03
0

Your only problem is bad typing. You get the error -bash: XXX: command not found when you type something on the command line that isn't a built-in shell function or external executable program in your path. You got -bash: dvm: command not found when you tried to run rvm because you typed dvm instead.

Your $PATH is fine, as /bin is right in there in the middle, so there's no problem with /bin/bash being found.

In order to see what the contents of /etc/profile or ~/.bashrc are, you can't just type their names, like you were doing in the comments to Randy Howard's question, you have to use a command like cat /etc/profile to list its contents.

MattDMo
  • 100,794
  • 21
  • 241
  • 231
  • I'm limited on my time and I didn't see an answer that helped, so I wiped. Thanks for the help though. I was finally able to figure it out and I just created my first ruby on rails app! Score! Thanks again. – ibadukefan Apr 01 '13 at 20:09
0

I didn't have a bash profile. So I created one and voila, no more errors. Thanks again fellas for trying to help a noob!

ibadukefan
  • 47
  • 1
  • 2
  • 6