$PATH is driving me nuts

Posted by Chris4d on Super User See other posts from Super User or by Chris4d
Published on 2012-10-01T21:03:17Z Indexed on 2012/10/01 21:41 UTC
Read the original article Hit count: 254

Filed under:
|
|
|

OK, apologies if this is something dumb, but I'm running out of ideas.

Goal: prepend /usr/local/bin to $PATH

Problem: $PATH won't do what I want or expect

How I got here: I want to start learning to program, so I'm getting comfortable messing around under the hood, but don't have a lot of experience. I installed the fish shell (because it's friendly!) using homebrew and set it as my default shell (under system prefs>users & groups>advanced). At some point, I ran brew doctor to see if my installs were all kosher, and it suggested I move /usr/local/bin to the front of $PATH so that I could use my installation of git rather than the system copy. Fine - but between path_helper and fish, something was happening to $PATH that was out of my control, and I could never get the paths arranged in the right way.

Environment: OSX 10.8.2, upgraded from 10.7ish, with xcode and devtools installed, plus x11, homebrew, and fish

More info: I've set my user's default shell back to bash, and tried a variety of shells thru terminal.app - bash, fish, sh. I moved /usr/local/bin to the top of /etc/paths but it didn't change anything. I looked thru the various config.fish files and commented out stuff that might mess with $PATH, didn't help. I have the following files in /etc/paths.d/:

./10-homebrew containing /usr/local/bin

./20-fish containing /usr/local/Cellar/fish/1.23.1/bin

./40-XQuartz containing /opt/X11/bin

I added set +x to my profile and when I start terminal.app I get:

Last login: Mon Oct  1 13:31:06 on ttys000
+ '[' -x /usr/libexec/path_helper ']'
+ eval '/usr/libexec/path_helper -s'
++ /usr/libexec/path_helper -s PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/Cellar/fish/1.23.1/bin:/opt/X11/bin";
export PATH;
+ '[' /bin/bash '!=' no ']'
+ '[' -r /etc/bashrc ']'
+ . /etc/bashrc
++ '[' -z '\s-\v\$ ' ']'
++ PS1='\h:\W \u\$ '
++ shopt -s checkwinsize
++ '[' Apple_Terminal == Apple_Terminal ']'
++ '[' -z '' ']'
++ PROMPT_COMMAND='update_terminal_cwd; '
++ update_terminal_cwd
++ local 'SEARCH= '
++ local REPLACE=%20
++ local PWD_URL=file://Chriss-iMac.local/Users/c4
++ printf '\e]7;%s\a' file://Chriss-iMac.local/Users/c4 
Chriss-iMac:~ c4$

So it looks like path_helper runs, but then running echo $PATH nets me /usr/bin:/bin:/usr/sbin:/sbin. So, it looks like path_helper isn't even doing what it's supposed to anymore?

I'm sure there is some well-defined behavior here that I don't understand, or I borked something while trying to fix it. Please help!

© Super User or respective owner

Related posts about osx

Related posts about path