3

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?

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
Holger Sindbaek
  • 2,278
  • 6
  • 41
  • 68
  • It's duplicate of http://stackoverflow.com/questions/8872447/error-undefined-method-when-installing-imagemagick-through-homebrew/8873435#8873435 and http://stackoverflow.com/questions/8884601/validating-a-pictures-size-in-ror-without-imagemagick . Why are you creating duplicates of your own questions? – Volodymyr Rudyi Jan 16 '12 at 20:55
  • It's not a duplicate. In the first one, I'm asking why I can't install ImageMagick through Homebrew and in the second one I'm asking if there's another way to validate a pictures size without using ImageMagick. Here I'm asking if it's really true that Homebrew simply doesn't work with version 1.9.2 of Ruby. Can you tell me if that's the case? – Holger Sindbaek Jan 16 '12 at 21:00
  • I certainly have... I just posted the full error I get after doing brew doctor in the main post --> – Holger Sindbaek Jan 16 '12 at 21:07
  • First of all, you've already got an answer : you should try to upgrade your homebrew via "brew update". My version of brew doesn't complain on rubies v 1.9.2 and v 1.9.3 and everything works fine. Also you should consider adding /usr/local/bin to the beginning of your PATH variable. – Volodymyr Rudyi Jan 16 '12 at 21:08
  • Have done brew update. What is my PATH variable? – Holger Sindbaek Jan 16 '12 at 21:09
  • My typing speed is too low. Try to add /usr/local/bin to your path in your .bashrc as it said in "brew doctor" output. – Volodymyr Rudyi Jan 16 '12 at 21:10
  • Mine too :-). I'm very sorry for being so noobish, but where is my .bashrc-file? – Holger Sindbaek Jan 16 '12 at 21:13
  • Usually in your home directory: `~/.bashrc` – michaelmichael Jan 16 '12 at 21:18
  • I've got one under the user I'm logged into, but not in my home directory. When I open it, it says: $HOME [[ -s $HOME/.rvm/scripts/rvm ]] && . $HOME/.rvm/scripts/rvm – Holger Sindbaek Jan 16 '12 at 21:20
  • How about `~/.bash_profile`? Is there a line that says `export PATH=[a bunch of directories]` – michaelmichael Jan 16 '12 at 21:41
  • If I do ~/.bash_profile? in the terminal, I get: -bash: /Users/holgersindbaek/.bash_profile: No such file or directory – Holger Sindbaek Jan 16 '12 at 21:46
  • Have you replaced the system ruby on your mac? The `brew` executable has `#!/usr/bin/ruby` at the start, so it should be using the system ruby, which is 1.8.7. – matt Jan 16 '12 at 21:51
  • I do think I have yes. It's not under the normal path. How do you re-install the system ruby? Delete Xcode and install it again? – Holger Sindbaek Jan 16 '12 at 21:56
  • @HolgerEdwardWardlowSindbæk I don't know how to reinstall system ruby, but if you have changed it that will be your problem. Try to find out how to reinstall the system 1.8.7 ruby, then if you want to use other versions use something like rvm to install them alongside, but leave the system version alone! Homebrew uses 1.8.7 as this is the system version, so it can be assumed it already exists, and Apple also install some ruby files as part of the OS which may depend on the version. Note ruby isn't installed as part of XCode, it's part of the base OS install. – matt Jan 16 '12 at 22:15

2 Answers2

12

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.

Community
  • 1
  • 1
michaelmichael
  • 13,755
  • 7
  • 54
  • 60
2

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

Community
  • 1
  • 1
Michael
  • 548
  • 8
  • 30