Path Variables

How to check path for Unix operational system

Open terminal, type the following code.

% echo $path
/opt/homebrew/bin /opt/homebrew/sbin /usr/local/bin /System/Cryptexes/App/usr/bin /usr/bin /bin /usr/sbin /sbin /bin/zsh /Library/TeX/texbin /Library/Apple/usr/bin

It will show you all the paths in one line (Quite Messy). But you can use the following code to ask the terminal to show all the paths vertically.

% tr ':' '\n' <<< $PATH
/opt/homebrew/bin 
/opt/homebrew/sbin 
/usr/local/bin
/System/Cryptexes/App/usr/bin 
/usr/bin 
/bin 
/usr/sbin 
/sbin
/Library/Apple/usr/bin

How to edit the path variable

We will use command: sudo to access the editor of the path variable and we can simply use nano to edit the variables. It requires you to type in your passwords.

% sudo nano /etc/paths
Password: