Search code examples
pythonrubyunixmacportsrbenv

Path location of rbenv and MacPorts


I have been using python for months & I have python & git installed on a Mac via MacPorts in bash_login @ export PATH="opt/local/bin:/opt/local/bin/mysql5/bin:/opt/local/lib/postgresql90/bin:/usr/local/bin:/usr/local/sbin:$PATH"

Today I wanted to try ruby so I installed Rbenv & ruby 1.9.2-p290 via ruby-build. It created a path in bash_profile @ PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)"

When I echo $PATH in the terminal my path is now set to:/Users/demet8/.rbenv/shims:/Users/demet8/.rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

I am no longer able to use my python/git/ because my system is reading Usr/local/ first in the bash_profile (file).

Question: I need opt/local/ to read first so I can still use python/git. Should I eliminate the bash_profile (file) rbenv created & consolidate rbenv's path into my bash_login path?


Solution

  • You should consolidate all paths in your bash_profile file. The macports path and rbenv are distinct and can be pulled together without conflict of order.

    I use both Macports, Python and Rbenv & Ruby.

    My consolidated path looks like this:

    /Users/user1/.rvm/gems/ruby-1.9.2-p290/bin:
    /Users/user1/.rvm/gems/ruby-1.9.2-p290@global/bin:
    /Users/user1/.rvm/rubies/ruby-1.9.2-p290/bin:
    /Users/user1/.rvm/bin:/opt/local/bin:
    /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:
    ....
    

    You could have it like this:

    PATH="$HOME/.rbenv/bin:$PATH" eval "$(rbenv init -)"
    export PATH=$PATH:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin