Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>By default, rubygems on a mac installs executables into <code>/usr/bin</code> rather than under the gem dir at <code>/Library/Ruby/Gems</code>. However, these directories have different permissions:</p> <pre><code>~ $ ls -ld /usr/bin/ /Library/Ruby/Gems/ drwxrwxr-x 4 root admin 136 15 Nov 22:19 /Library/Ruby/Gems/ drwxr-xr-x 1085 root wheel 36890 11 Feb 22:57 /usr/bin/ </code></pre> <p>so although they are both owned by <code>root</code>, the gems directory is writable by anyone in the <code>admin</code> group, and <code>/usr/bin</code> isn't.</p> <p>What seems to have happened here is bundler hasn't been able to install the heroku executable into <code>/usr/bin</code> when it installed the gem, probably because of this permissions issue. <a href="http://yehudakatz.com/2010/04/12/some-of-the-problems-bundler-solves/" rel="nofollow">This blog post</a> suggests this has been a problem with earlier versions of bundler on OSX.</p> <p>The executable that rubygems installs is <em>not</em> just a copy of the heroku script from the bin directory of the gem (i.e. <code>/Library/Ruby/Gems/1.8/gems/heroku-1.18.3/bin</code>). Instead it is a wrapper script generated by rubygems that first loads up rubygems to enable it to work it's magic on the ruby load path so that when the script itself is then called any <code>require</code> statements are able to find the appropriate libraries.</p> <p>This means that if you call the script directly, rubygems won't be loaded so the load path won't be set up right and, as you've seen, you'll get errors about missing dependencies. To demonstrate this, try running</p> <pre><code>$ ruby -rubygems /Library/Ruby/Gems/1.8/gems/heroku-1.18.3/bin/heroku </code></pre> <p>which runs the script but loads up rubygems first. This should (might - I don't know for certain) work.</p> <p>This is also why <code>bundle exec heroku</code> works. Bundler sets up the load path as needed. Furthermore, doing this ensures the load path is set up to match your <code>Gemfile.lock</code> file - indeed this is the point of bundler.</p> <p>I wouldn't recommend adding anything to your <code>$PATH</code>. As we've seen it doesn't work, but also you'll need to change it every time you upgrade to a newer version of the heroku gem.</p> <p>I would also recommend against adding anything to your <code>$RUBYLIB</code> variable either. Doing so may actually get the heroku command working, but the whole point of using rubygems and bundler is that they manage stuff like this for you.</p> <p>My first recommendation would be to use <a href="http://rvm.beginrescueend.com/" rel="nofollow">rvm</a>. It's a very useful tool, and I think it'd be worth spending some time looking into it.</p> <p>If you're unable or unwilling to do that, then you probably need to reinstall the heroku gem, and check it gets installed correctly. First remove the existing gem with:</p> <pre><code>$ sudo gem uninstall heroku </code></pre> <p>Then make sure you've got the latest version of bundler:</p> <pre><code>$ sudo gem update bundler </code></pre> <p>Finally reinstall with</p> <pre><code>$ bundle install </code></pre> <p>and it should ask for your password to install the executables into the right place. Note <em>don't</em> use <code>sudo</code> here - see the link above for details.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload