What files can contain PATH declarations for an OS X terminal?

So, I have a problem with the path on OS X Leopard. OS X seems to add other paths that I don't declare, and it is messing around with my path priority. I only have a .bash_login file, I don't have a .bashrc or .profile file. My .bash_login file is as follows:

 export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:$PATH" 

When I start the export, this is the path that it returns:

 PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin" 

Any ideas on what / usr / bin can put, and how I could get /usr/local/bin for a higher priority.

I tag this for Rails too, because that's what I'm working on right now ... it seems that the built-in Ruby, Rails, and Gems Macs take precedence over the one I installed in /usr/local/bin , maybe you Rubist comrades could help too.

+6
ruby-on-rails sysadmin macos
source share
5 answers

You have looked into these two directories:

 /etc/paths.d/ /etc/manpaths.d 

Any paths defined in files in these directories are automatically added to the PATH variable - I mainly use these two directories to host third-party installed applications in PATH. Also, look at the path_helper on OS X.

EDIT . After looking at the contents of /etc/profile , I see that path_helper is executed first. The path_helper page for path_helper says that before reading files in the /etc/paths.d/ and /etc/manpaths.d/ path_helper reads and sets the paths defined in the /etc/paths and /etc/manpaths . A look at /etc/paths reveals this:

 $ cat /etc/paths /usr/bin /bin /usr/sbin /sbin /usr/local/bin 

And, I believe, these parts make up half of what you see as set in PATH.

+17
source share

It seems your changes are not applied. Note no / usr / local / mysql / bin

Read the man bash section in the INVOCATION section, .bash_login will only be read if it is a login shell that is not in the terminal shell. You should put it in ~ / .bashrc. It will be read for logins and invalid shells.

+4
source share

You can also put the material in ~ / .MacOSX / Environment.plist, as described in https://web.archive.org/web/20150330034300/http://www.astro.washington.edu/users/rowen/AquaEnvVar. html

This will make environment variables accessible to all applications, and not just to those launched through a terminal session (bash).

(It seems that there is a better offer)

+1
source share

I also found an interesting article on the Apple support forums:

. bash_login is no longer running

With this information, I discovered a missing empty .bash_profile file that I had with the download and killed all the information that I was trying to install in my path.

So, I think it seems that depending on the situation, we may have several β€œcorrect” answers.

0
source share

Just type .bashrc or .login and you'll be fine

0
source share

All Articles