0

I was screwing around with my .bash_profile, and did something wrong - a fair amount of commands don't work for me anymore.

-bash: jekyll: command not found

I've tried a bunch of the stuff on stackoverflow and other sites already, but can't seem to get it working.

Most commands are still working (cd, mv, ls, vim, git, even s3cmd), but others (rails, jekyll) are not working for some reason.

How I get here was I started out trying to get the command 'subl' to work, so pasted in this to command line (via this tutorial)

$ ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/subl

It didn't work for me (later I'm realized it's because the app is Sublime Text, and not Sublime Text 2), but eventually found my way to a different page, that told me to open my bash_profile and paste this in.

alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"

Upon opening my bash_profile (vim .bash_profile), it prompted with some sort of error (I think conflicting file), so I Recovered it. After that, pasted the above in, saved and exit.

On reloading (opened a new tab), was running into a bunch of errors and my commands were no longer working. Hours later, having tried many things, this is my current status

$ echo $PATH

 /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/ChrisYin/usr/bin:/Users/ChrisYin/usr/bin:/Users/ChrisYin/usr/bin:/Users/ChrisYin/usr/bin

$ open .bash_profile

export ARCHFLAGS="-arch x86_64"
export PATH=$PATH:~/usr/bin
alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Eventually what I did try was deleting my .bash_profile, and reinstalled rails. I got rails and jekyll working again, but then I opened up a new tab, and none of them were working again.

Any help appreciated, thanks.

Chris Yin
  • 761
  • 1
  • 11
  • 23
  • 1
    Can you actually post the PATH parts of your `bash_profile`? On a wild guess since some of your other paths contain spaces, try quoting all instances of $PATH in your bash_profile (i.e. change `export PATH="$PATH:~/usr/bin"`)? Also where are the rails and jekyll executable actually located? – Reinstate Monica Please Mar 16 '14 at 22:23
  • the file above is my entire bash_profile. and just tried quoting all instances of $PATH, didn't do anything. and hot sure, how to check? quick search for 'jekyll' yields '/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang' – Chris Yin Mar 17 '14 at 00:00
  • quoted all instances of $PATH broke all of my commands now, rm, mv, open, vim, no longer work either. help! – Chris Yin Mar 17 '14 at 00:08
  • Bizarre. Try hard-coding all your PATHs in one place. i.e. `PATH="/usr/bin" PATH="$PATH:/usr/sbin" ... export PATH`, etc... With each PATH=whatever on a new line (or just do PATH=the_long_path_you_printed_above") – Reinstate Monica Please Mar 17 '14 at 01:51

2 Answers2

2

Try adding /opt/local/bin to your path into the .bash_profile:

export PATH=/opt/local/bin:$PATH
egor7
  • 4,678
  • 7
  • 31
  • 55
0

More of a comment than an answer, but long quotes/code looks terrible in comments.

Very strange that you're getting an error here, but try just hard-coding all your paths in one place. e.g. Change your bash_profile to

export ARCHFLAGS="-arch x86_64"
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/Users/ChrisYin/usr/bin:/Users/ChrisYin/usr/bin:/Users/ChrisYin/usr/bin:/Users/ChrisYin/usr/bin"
PATH="$PATH:~/usr/bin"

# Assuming your jekyll is found here
PATH="$PATH:/opt/local/var/macports/sources/rsync.macports.org/release/tarballs/ports/lang" 

export PATH

alias subl="/Applications/Sublime\ Text.app/Contents/SharedSupport/bin/subl"
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

Than make sure you source it by source bash_profile or re-initalize bash.

I would also comment out any PATH statements from any other initialization files, namely .bashrc in case it accidentally override the .bashrc ones (can't remember which one gets sourced first offhand, but better to have them in one place anyway).

For figuring out where things got installed, easiest way would be to read whatever README/manual it has. Otherwise, you can search for it with something like below (locate database would be faster if you have one set up)

find / -name "jekyll"
find / -name "rails" 
Reinstate Monica Please
  • 11,123
  • 3
  • 27
  • 48