user321627
user321627

Reputation: 2564

How to find where my PATH variable is being generated and how to edit it in Mac OSX Terminal?

Currently I am in Mac OSX and when I try to find what my PATH is via Terminal, I get:

> echo $PATH
/Users/User1/google-cloud-sdk/bin:/usr/local
/bin:/usr/local/sbin:/usr/local/bin:
/usr/bin:/bin:/usr/sbin:/sbin:
/Library/TeX/texbin:/opt/X11/bin:
/Applications/Wireshark.app/Contents/MacOS

I would like to remove google-cloud-sdk, wireshark, and tex from PATH, but have no idea how to do it. When I look inside my etc/profile file, none of these apps are listed. Is there a way to clean up by $PATH? Thanks.

Upvotes: 0

Views: 4118

Answers (2)

Cam_Aust
Cam_Aust

Reputation: 2789

Go to your home directory. If you open a fresh Terminal window/session, this will probably have you in your home directory.

Type,

ls -al

This should give you a list of the files in your home directory, including invisible files. Check there is a file called .bash_profile. The "." means it is an invisible file.

If that exists (as it should) type:

nano .bash_profile

This will open this file in the text editor program called "nano". In this file you should find statements like:

export PATH="/Library/Frameworks ....

There should be similar PATH statement for the options you want to remove.

Delete those lines and then exit nano by ^O for writing out, and you need to print Y to save. Then ^X to exit nano.

Upvotes: 2

Santa Claus
Santa Claus

Reputation: 1002

I just found the Wireshark path file in :

/etc/paths.d/

Upvotes: 3

Related Questions