Trying to set up Homebrew on a new Mac (on previous Macs I would install packages from source).
The first package I tried to install was Git:
$ brew install git
Installation went OK, but which git
still shows the one in /usr/bin/git
that came along with Lion (I think?). And not the one in /usr/local/bin/git
that was just installed.
$ echo $PATH
/Users/meltemi/.rvm/gems/ruby-1.9.2-p290@rails31/bin:/Users/meltemi/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/meltemi/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/michael/.rvm/bin:/usr/local/mysql/bin:/opt/subversion/bin:/Developer/Additions/checker/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
As you can see /usr/bin
defaults to before /usr/local/bin
in the $PATH
So, I'm confused! I thought the point of HomeBrew (and something the creators seem to brag about) was that you don't have to mess with the $PATH
variable!?!
So, what did I do wrong?
Answer
I found this related post to be very helpful. Instead of changing the $PATH
variable, it just has you simply edit your /etc/paths
file.
Homebrew wants me to amend my PATH; no clue how
As soon as I followed the directions and put /usr/local/bin
above /usr/bin
, my issues were resolved.
- On OS X, open Terminal
- Type the command:
sudo vi /etc/paths
- Enter your password if you're asked for it
- You will see a list of paths. Edit them so that
/usr/local/bin
path is entered above the/usr/bin
path - *Save and quit
- Restart Terminal
Here's what mine looks like after I did that:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
*To save and quit type a colon (:
), then type wq
(to write and quit at the same time), followed by Enter.
You can also open the /etc/paths
file in a graphical text editor and edit it that way.
Credit to fengd
over at Stack Overflow for his answer over there.
No comments:
Post a Comment