0

The Problem

I can't install ruby gems properly, here's what I get trying to install and run chef:

$ gem install chef && chef
Successfully installed chef-11.6.0
Parsing documentation for chef-11.6.0
1 gem installed
bash: chef: command not found

My path is:

$ echo $PATH
/Users/mcarey/.rvm/gems/ruby-2.0.0-p0/bin:/Users/mcarey/.rvm/gems/ruby-2.0.0-p0@global/bin:/Users/mcarey/.rvm/rubies/ruby-2.0.0-p0/bin:/Users/mcarey/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/mcarey/.rvm/gems/ruby-2.0.0-p0/gems

Background/History

It was all working fine until I accidentally (long story short) created a tilde (~) directory and then tried to remove it with 'rm -R ~', this of course started deleting my home directory but once it hit the first protected file it asked for permission and I cancelled it. My old ~/.bash_profile was removed but I'm not sure what else went.

Any thoughts? Any extra info needed?

Community
  • 1
  • 1
MatCarey
  • 2,409
  • 1
  • 16
  • 12
  • 1
    Why do you think it shoud have `bower` executable file? It doesn't have one as I can see in it's repository https://github.com/spagalloco/bower – Yevgeniy Anfilofyev Sep 07 '13 at 08:18
  • From the readme, it looks like a suitable command line might be `rails generate bower:install`, provided your goal is to add `bower` support to a new Rails project. Otherwise, you don't need to run anything, just `require 'bower'` in your project – Neil Slater Sep 07 '13 at 08:42
  • Why do you think it should have bower executable file? Only because I thought I had one before, there are some gems which i know I want executables for (e.g. less, sass) I'll see if Bower was a bad example. – MatCarey Sep 07 '13 at 08:58
  • "just require 'bower' in your project" - what project? ;) I'm not running a rails project. I work on all sorts of different projects, some are rails, some aren't and I've got (or at least had) a load of tools installed for that before this stupid mistake. – MatCarey Sep 07 '13 at 09:02
  • OK, it looks like Bower's a bad example - the readme says to install through npm, not gem. I'll check a different example and see if the problem still exists. – MatCarey Sep 07 '13 at 09:04
  • Just for clarity I've updated the example from bower to chef (because I know chef uses a command-line tool). – MatCarey Sep 07 '13 at 09:23

1 Answers1

0

If you deleted your ~/.bash_profile file, I think that Gems will work until you fix your path in this new file. So :

  1. Be sure that you have recreated your ~/.bash_profile file in your home folder (terminal command : mate ~/.profile)
  2. Check if this line exists export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
  3. if this line does not exist, add this in your file
  4. save the file
  5. To check if the file is correct input . ~/.profile in the terminal

I guess your probleme is only a path problem but if you face with another problem here is a link where to find more info

But if your path is correct you can try to use your gem this way:

  1. Go to your application root folder
  2. bundle install
  3. bundle exec bower

=> MAYBE THIS CAN HELP : Checking documentation in github and google, ifound this article there is a possibility to use the bower-rails gem.

in your Gemfile:

gem "bower-rails", "~> 0.4.4"

I hope this will help :)