Tell me more ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

(this is a dupe from SuperUser - dunno if that's bad form, please delete if so)

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

Goal: prepend /usr/local/bin to $PATH system-wide (for all shells, scripts etc)

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$

It looks like path_helper runs, but then running echo $PATH nets me /usr/bin:/bin:/usr/sbin:/sbin. So, 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!

share|improve this question
note, I can get it to work for fish by creating ~/.config/fish/config.fish with set PATH /usr/local/bin $PATH but I still have the issue of path_helper apparently not working like it should, and $PATH thus being incomplete. Also still have the issue of different $PATH for scripts, apps started from the GUI, etc. – Chris4d Oct 1 '12 at 22:33
Questions about shells are on topic both here and on Superuser - I suspect they will get a quicker/better answer on SuperUser as that includes all the Linux/Unix users as well as OSX command line users - so wat question was it on SU? – Mark Oct 2 '12 at 1:49
For GUI also see this question – Mark Oct 2 '12 at 1:50
Mark, same title on SuperUser. I'll look into that link, thanks for the help. I was hoping this board would have people more familiar with path_helper since that's OSX-specific. – Chris4d Oct 2 '12 at 4:01
More or less figured it out on the SuperUser question here. Thanks for reading. – Chris4d Oct 2 '12 at 4:38

closed as not a real question by patrix, Stu Wilson, CajunLuke, gentmatt, jmlumpkin Oct 4 '12 at 23:23

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.

Browse other questions tagged or ask your own question.