How to Set the Mac’s $PATH back the way it was before

terminal

I'm just getting started with Terminal, the other day I might have messed something up with my urs/local/bin. When executing echo $PATH it returns me with /usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin the original path was /usr/local/bin How do I set it back to factory settings?

Thanks in Advance for your Help.

Best Answer

By default the paths are saved in the file /etc/paths. You can edit it e.g. with sudo vim /etc/paths. Each line should contain one directory used for $PATH.

Then there is the directory /etc/paths.d/ that can contain text files with paths in it.

Furthermore the path can be modified in the files ~/.bashrc and ~/.bash_profile.


However, the $PATH you are stating is the default one and usually desired. Restricting it to only /usr/local/bin would make a lot of default applications - like vim, ls, or even sudo that reside in /usr/bin/ or /bin/ - inaccessible without typing their whole paths every time.

Related Question