Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Default PATH variable set with .bash_profile empty

I remember after a fresh install of os x, when i did a echo $PATH in the terminal, it responded with a blank line. Now after installing some tools over time, the $PATH variable has /usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin value although my .bash_profile is blank. I was wondering where this value is being set?

like image 896
shaveenk Avatar asked Jul 27 '13 03:07

shaveenk


People also ask

How do I permanently set PATH variable in Linux?

Manipulating your PATH variable To make the change permanent, enter the command PATH=$PATH:/opt/bin into your home directory's . bashrc file. When you do this, you're creating a new PATH variable by appending a directory to the current PATH variable, $PATH . A colon ( : ) separates PATH entries.

What is PATH variable in Bash profile?

The first edit to your Bash profile is to correct your PATH. PATH is an environment variable, which simply means that it represents some small bit of data while you use Terminal. Specifically, PATH contains a list of file system paths where the operating system can find programs to run.

Where is path set in Linux?

Using a Profile File to Set your PATH User profiles are loaded at login. The PATH variable can be set in the ~/. profile file. As in all prior examples, we will need to source these changes to make them active for the current shell, but subsequent logins will persist the changes.

Where is bash_profile located windows?

bash_profile in your user directory: C:\Users\<username>. If aliases for Git commands are needed, editing the . gitconfig file is usually sufficient.


2 Answers

Plausible candidates would be /etc/profile and /etc/bashrc; there's also /etc/paths and /etc/paths.d to look at. You might also need to look at $HOME/.profile and $HOME/.bashrc. There might be some other places that bash looks too.

like image 190
Jonathan Leffler Avatar answered Oct 16 '22 20:10

Jonathan Leffler


As of macOS Catalina, Mac defaults the shell to zsh (Z shell). This type of shell uses .zprofile instead of .bash_profile. To check if you are on bash or zsh, run echo $SHELL. If the result is bin/zsh, you are on zsh. In which case edit your ~/.zprofile for env variables.

like image 38
Matt C. Avatar answered Oct 16 '22 20:10

Matt C.