简体   繁体   中英

Using brew with Ruby 1.9.2

I'm trying to get ImageMagick with Homebrew, but I keep getting errors. Then I did a "brew doctor" and I get:

Ruby version 1.9.2 is unsupported.

Homebrew is developed and tested on Ruby 1.8.x, and may not work correctly on Ruby 1.9.x. Patches are accepted as long as they don't break on 1.8.x.

==> /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. This is an issue if you eg. brew installed Python.

Consider editing your .bashrc to put: /usr/local/bin ahead of /usr/bin in your PATH.

Can this really be true?

If so, what are my other options here?

Since the comments thread has gotten too long, I'm going to type the rest of the answer here. First, try adding /usr/local/bin to your PATH before /usr/bin . As the error message above indicates, doing this allows your system to call the programs installed by homebrew before the system-provided ones. For example, if you install Python via brew python , but don't change the PATH, your system will look first in /usr/bin , see Python there, and won't look any further. It'll miss the version you installed in /usr/local/bin with homebrew.

Changing your PATH on Mac OS X is a little different than on other systems. There's a good answer here at Superuser on changing the PATH in Mac OS X. Look in the files mentioned in the linked question's top answer ( /etc/profile , ~/.bash_profile , ~/.bash_login , ~/.profile ) to find where your PATH variable is defined, and move /usr/local/bin before /usr/bin . For example, if your ~/.bash_profile has a line that looks like this:

export PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/local/bin

You'll want to change it to move /usr/local/bin before /usr/bin , like so:

export PATH=/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/local/bin

Setting and changing the PATH is less about programming than it is about Mac OS X system administration, thus falling out of the scope of Stack Overflow. If you run into problems, or are still confused, I'd recommend asking a question on http://apple.stackexchange.com . There are a lot of very experienced Apple users there who are familiar with system administration in Mac OS X.

Comment from Sathya in this post helps me. Instead of anything else. Look in the /etc/paths file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM