Upgraded to El Capitan, now middleman: command not found

Hi, even though it looks installed I keep getting this error.
gem: 2.4.8
Any idea?

dagobah:$ sudo gem install middleman
Successfully installed middleman-3.4.0
Parsing documentation for middleman-3.4.0
1 gem installed
dagobah:$ middleman init test_project
-bash: middleman: command not found
dagobah:$ gem list middleman
*** LOCAL GEMS ***

middleman (3.4.0)
middleman-core (3.4.0)
middleman-livereload (3.1.1)
middleman-sprockets (3.4.2)

Check that your PATH variable is set have access to the gems.
You can run gem env to see the INSTALLATION DIRECTORY, this is where your gems are currently being installed to. Adding this path to your PATH should allow middleman to work again.

Are you using rvm or rbenv to manage ruby? What does your shell return if you run:
which ruby
which gem

RubyGems Environment:
  - RUBYGEMS VERSION: 2.4.8
  - RUBY VERSION: 2.0.0 (2015-04-13 patchlevel 645) [universal.x86_64-darwin15]
  - INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.0.0
  - RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
  - EXECUTABLE DIRECTORY: /usr/bin
  - SPEC CACHE DIRECTORY: /Users/username/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
  - RUBYGEMS PLATFORMS:
    - ruby
    - universal-darwin-15
  - GEM PATHS:
     - /Library/Ruby/Gems/2.0.0
     - /Users/username/.gem/ruby/2.0.0
     - /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/gems/2.0.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin
     - /Users/username/.rvm/bin
dagobah:~ username$ which ruby
/usr/bin/ruby
dagobah:~ username$ which gem
/usr/bin/gem

Looks like there are a couple issues here:

  1. Your GEM PATHS are not in your SHELL PATH
    In a terminal window, if you run echo $PATH you need to see one (or more) of those GEM PATHS listed in the PATH output to run middleman.

  2. System Ruby versus RVM
    When you run which ruby, you’re seeing the default Ruby version OS X ships with, but it’s not typical for Ruby developers to use that Ruby. RVM or rbenv allow you to install and manage a bunch of Ruby releases separately from system, which is a good practice to follow.

You have RVM installed, so you should set your default RVM ruby and use RVM instead of system:
https://rvm.io/rubies/default

Once you can run which ruby and see something like this below, things will be better:
Users/ewlarson/.rvm/rubies/ruby-2.2.2/bin/ruby

After you are using an RVM ruby, re-install middleman:
gem install middleman

Thanks,
switched to Ruby 2.2.3. Solved!

I have the same problem, but i am using rbenv. When running which ruby i get /Users/***/.rbenv/shims/ruby. After having successfully installed middleman, i get the same error: -bash: middleman: command not found

FIXED it myself :wink: Under rbenv you have to run rbenv rehash to init new gems.

I’m getting a similar error under rbenv. When I change to the project directory and enter the command middleman I get: /Users/user/project_name not found where ‘user’ is my user name and ‘project_name’ is the name of the project directory.

Could this be related?