etc/paths modifications not taken into account in OS X Mountain Lion - macos

I installed node.js, pip, rvm a few weeks ago. I just installed them and checked everything was working fine.
Yesterday, as I tried to install howdoi (https://github.com/gleitz/howdoi) using zsh via pip, I got a pip : command not found error message.
The echo $PATH command gave me this:
"rvm stuffs":/usr/bin:/bin:/usr/sbin:/sbin:
Then, I checked the etc/paths file:
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
It looks like /usr/local/bin is in my etc/paths file but not in my path.
I temporarily fixed this with a temporary solution:
export PATH=$PATH:/etc/paths
This morning, I am looking for a permanent solution.

You could add this to your ~/.profile, ~/.bashrc, or ~/.bash_profile. In Terminal:
cat << EOF >> ~/.profile
PATH=/usr/local/bin:\$PATH; export PATH
EOF
Open a new Terminal (Command + N) and test the change:
echo $PATH

Related

Mac brew doctor show Warning: Homebrew's sbin was not found in your PATH but you have installed formulae that put executables in /usr/local/sbin

I try to upgrade python2.7 to python3 on macOS Catalina, when I run brew doctor, it shows:
Warning: Homebrew's sbin was not found in your PATH but you have installed
formulae that put executables in /usr/local/sbin.
Consider setting the PATH for example like so:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
So I try the command echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc which did not works.
Apple macOS has moved from Bash shell to Zsh (Z Shell).
Solution:
Run the command below in your terminal:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
Now quit the terminal by pressing command+q, re-open the terminal and run brew doctor
You need to close and re-open your terminar after applying:
echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.zshrc
After some search I found the commands that works for me:
export PATH="/usr/local/bin:$PATH"
source ~/.bash_profile
If you write brew doctor in the IDE terminal, then do it in the system terminal, it should work

Terminal PATH has disappeared OSX - how to reset?

Something has happened to my $PATH variable -- how do i reset it to its initial settings?
If I run the command
$ cat /etc/paths
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
Then this is all correct. But when I run the command
$ echo $PATH
/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/sdev/Library/Enthought/Canopy_64bit/User/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/bin:/usr/bin:/usr/bin:/bin
I tried to fix this by using
export pathname
Need to restore to what it ought to be: I should just have this pathname when i run echo $PATH. I uninstalled Canopy which I thought would solve the problem.
/usr/bin
If you want to reset your PATH back to just /usr/bin/ put this in ~/.bash_rc
export PATH="/usr/bin/"
Or whatever you want between the quotes. Then you can run source ~/.bash_rc in terminal and the path will be set to what you set it as in .bash_rc.

Messed system paths and cannot start apps

I edited /etc/paths, putting the local directories on top, and now I cannot run commands in terminal, including sudo, and am afraid this will affect the system outside terminal.
Trying to solve it, I have commented out everything and sourced .bash_profile and .bashrc, there is nothing under /etc/paths.d/, and /etc/paths is now:
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/bin
Yet the problem remains:
$ echo $PATH
/Volumes/Macintosh HD/Users/jsmm/.wp-cli/bin:/usr/local/bin:/Volumes/Macintosh HD/Users/jsmm/bin:/Volumes/Macintosh HD/Users/jsmm/.wp-cli/bin:/usr/local/bin:/usr/local/sbin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/mysql/bin:/usr/local/bin:/usr/local/sbin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/mysql/bin:/Volumes/Macintosh:/Volumes/Macintosh:/Volumes/Macintosh HD/Users/jsmm/.wp-cli/bin
And:
$ /usr/libexec/path_helper -s
PATH="/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/Volumes/Macintosh HD/Users/jsmm/.wp-cli/bin:/Volumes/Macintosh HD/Users/jsmm/bin:/usr/local/sbin:/Applications/Postgres.app/Contents/MacOS/bin:/usr/local/mysql/bin:/Volumes/Macintosh"; export PATH;
System is Mac OS X 10.8 Mountain Lion. Looking forward to your help,

Heroku does not install toolbelt PATH by default on OSX with bash

Installing heroku-toolbelt/2.32.9 on OSX 10.7.4 fails to setup the PATH correctly for bash.
To fix this I created a .bash_profile with a correct PATH:
$ cat ~/.bash_profile
export PATH=/usr/local/heroku/bin/:$PATH
I did this instead:
$ touch ~/.bash_profile
export PATH=/usr/local/heroku/bin/:$PATH

How to modify PATH for Homebrew?

Trying to install ruby 1.9.3, read that I need to install homebrew first. Ran brew doctor, and it's giving me a bunch of warnings. One of which is:
Warning: /usr/bin occurs before /usr/local/bin This means that
system-provided programs will be used instead of those provided by
Homebrew. The following tools exist at both paths:
easy_install
easy_install-2.6
Consider amending your PATH so that /usr/local/bin is ahead of
/usr/bin in your PATH.
How does one do what it's asking here?
open your /etc/paths file, put /usr/local/bin on top of /usr/bin
$ sudo vi /etc/paths
/usr/local/bin
/usr/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin
and Restart the terminal, #mmel
There are many ways to update your path. Jun1st answer works great. Another method is to augment your .bash_profile to have:
export PATH="/usr/local/bin:/usr/local/sbin:~/bin:$PATH"
The line above places /usr/local/bin and /usr/local/sbin in front of your $PATH. Once you source your .bash_profile or start a new terminal you can verify your path by echo'ing it out.
$ echo $PATH
/usr/local/bin:/usr/local/sbin:/Users/<your account>/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
Once satisfied with the result running $ brew doctor again should no longer produce your error.
This blog post helped me out in resolving issues I ran into. http://moncefbelyamani.com/how-to-install-xcode-homebrew-git-rvm-ruby-on-mac/
Just run the following line in your favorite terminal application:
echo export PATH="/usr/local/bin:$PATH" >> ~/.bash_profile
Restart your terminal and run
brew doctor
the issue should be resolved
open bash profile in textEdit
open -e .bash_profile
Edit file or paste in front of PATH
export PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin:/usr/local/sbin:~/bin
save & close the file
*To open .bash_profile directly open textEdit > file > recent
To avoid unnecessary duplication, I added the following to my ~/.bash_profile
case ":$PATH:" in
*:/usr/local/bin:*) ;; # do nothing if $PATH already contains /usr/local/bin
*) PATH=/usr/local/bin:$PATH ;; # in every other case, add it to the front
esac
Credit: https://superuser.com/a/580611

Resources