Middleman installed but binary cannot be found - ruby

I just installed Middleman on my Mac (OS 10.8.2) but am unable to generate a new project. I have Xcode installed. Can anyone tell me what I might have done wrong?
$ middleman init moi
-bash: middleman: command not found
$ gem list
middleman (3.0.12)
middleman-core (3.0.12)
middleman-more (3.0.12)
middleman-sprockets (3.0.9)
$ ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin12.2.0]
I'm using rbenv. This is my path:
/Users/me/.rbenv/shims:/opt/local/bin:/opt/local/sbin:/Users/me/downloads/mongodb/bin:/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

If you’ve just installed a new gem in a Ruby installation managed by rbenv, you should run
rbenv rehash
after installing. This generates the shims for the newly-installed gem that will allow you to run it. You can read more in rbenv’s readme.

Related

Cannot use RSpec (rspec: command not found)

So I installed the newest version of Ruby:
ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19]
By following these steps:
brew install ruby
echo 'export PATH="/usr/local/opt/ruby/bin:$PATH"' >> ~/.bash_profile
source ~/.bash_profile
I needed to change the Path so that I could use the newest version of Ruby since if not, whenever I did
ruby -v
It would just take into account the default ruby version I had installed in my MAC:
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin19]
Everything works great but I want to install RSpec, so I do:
gem install rspec
This is what I get:
Successfully installed rspec-3.10.0
Parsing documentation for rspec-3.10.0
Done installing documentation for rspec after 0 seconds
1 gem installed
But once I check the version:
rspec --version
This is what I get:
-bash: rspec: command not found
I have uninstalled ruby with brew and installed it again and restarted the terminal but to no avail...Any idea why is this happening? How can I solve it?
Thank you!
It seems that installing Ruby via Home Brew was giving some problems when trying to run RSpec so I uninstalled it and installed it again via RVM. Although, as #Mskha said, Rbenv could also be a possible option.

Rvm version error

I have installed many flavors of ruby on rvm, and using following command to change rvm ruby versions.
rvm use 1.9.3
then ruby -v gives me following result
ruby 1.9.3p551 (2014-11-13 revision 48407) [i686-linux]
but when i try to run any commands like rails s or bundle install
it gives me following error
Your Ruby version is 2.3.1, but your Gemfile specified 1.9.3
Using
rvm list
you can get list of ruby version on your system along with current & default versions.
If ruby version is not specified in Gemfile, then it is generally considering default rvm version.
But if it is specified in Gemfile, then that version of ruby should be installed in your system along with its bundler.
First make sure ruby version either installing or using it,
rvm install '1.9.3'
rvm use '1.9.3'
To install bundle of required ruby version, run this command
gem install bundler
That's can happens, when you trying to use fresh installed ruby without bundler, all newest installed ruby should also include bundler installation.
$> rvm use 1.9.3 && gem install bundler # may terminal reload needed
$> bundle install
$> bundle exec rails s

Cannot find gem after bundle install

I'm trying to setup my environment to do development on Travis CI's dpl project.
I installed rbenv to manage my Ruby versions and I use Ruby 2.2.3.
Then I do bundle install and the gems are installed.
Then when I try to do bundle exec rake I get this error:
Could not find CFPropertyList-2.2.8 in any of the sources
Run `bundle install` to install missing gems.
This gem is installed. Can you tell me why it is not found by Bundler?
Here is a gist of the output of my commands: https://gist.github.com/cotsog/7bb87c84a636bcd3de65
Thanks for your help!
Update:
Additional info about my environment:
$ which ruby
/Users/me/.rbenv/shims/ruby
$ which bundler
/usr/bin/bundler
$ ruby --version
ruby 2.2.3p173 (2015-08-18 revision 51636) [x86_64-darwin14]
$ bundler --version
Bundler version 1.10.6

Installed Ruby 2.0.0, but an error tells me I have 1.9.3 installed

I just cloned my Rails app onto my new computer. Ruby 2.0.0 seemed to install with no issue, but when I run sudo bundle install inside my app, I get an error telling me I have Ruby 1.9.3 installed:
$ sudo bundle install
Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
and bundle install returns this:
$ bundle install
/home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler (LoadError)
from /home/user/.rvm/rubies/ruby-2.0.0-p643/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/bin/bundle:7:in `<main>'
I don't understand why I would have 1.9.3 installed. I used the command rvm install 2.0.0 to install Ruby.
Also, ruby -v returns:
ruby 2.0.0p643 (2015-02-25 revision 49749) [x86_64-linux]
What's going on?
Output of rvm list
$ rvm list
rvm rubies
=* ruby-2.0.0-p643 [ x86_64 ]
# => - current
# =* - current && default
# * - default
Because you're using rvm, you shouldn't ever need to use sudo on any of your commands. Using sudo is likely running the globally installed 1.9.3 version.
If you just installed Ruby 2.0.0 and haven't done anything else, then you most likely need to install bundler first before using it:
gem install bundler
Once you've done that, bundle install (without sudo) should work fine.

Ruby 1.92 and Mountain Lion

I just upgraded to Mountain Lion and had to install Xcode 4.4 (4.1 would not work). I believe this adversely affected my Ruby install, and more specifically Sass.
When I type $ sass --version I get the following error:
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:777:in 'report_activate_error': Could not find RubyGem sass (>= 0) (Gem::LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:211:in 'activate'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:1056:in 'gem'
from /usr/bin/sass:18
Any ideas? I am running ruby 1.9.2p320 (2012-04-20 revision 35421)
What I ended up doing was:
$ source ~/.bashrc
And then I did:
$ gem install sass --pre
And that worked. When I do $ sass -v it reports Sass 3.2.0.alpha.275and not the error message above.

Resources