Below is the environment in Mac: ~$ ~$ ~$ echo $0 -bash ~$ ~$ ~$ ~$ ~$ ~$ cat /etc/paths.d/go /usr/local/go/bin ~$ ~$ cat /etc/paths /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Users/MYUSER/go/bin ~$ ~$ ~$ echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Users/MYUSER/go/bin:/usr/local/go/bin ~$ ~$ uname -a Darwin XYXYXYXXYX 19.6.0 Darwin Kernel Version 19.6.0: Mon Apr 12 20:57:45 PDT 2021; root:xnu-6153.141.28.1~1/RELEASE_X86_64 x86_64 ~$ ~$ which go /usr/local/go/bin/go ~$ ~$ ~$ ~$ go version -bash: /usr/local/bin/go: No such file or directory ~$ ~$ ~$ ~$ /usr/local/go/bin/go version go version go1.16.4 darwin/amd64 ~$ ~$   I performed rm -rf /usr/local/go , rm  /usr/local/bin/go before installing new version go v1.16 that installs go binary in /usr/local/go/bin How to make go version command work?
106417
I have a program on my path.  The program runs when executed with a full path specified.  But the program cannot be found when I run it with just its name.    Essentially, I want to understand how the below output is possible, and how to fix it so that my program can actually be found without a full path specified:  root:/usr/local/bin# ./siege **************************************************** siege: could not open /usr/local/bin/etc/siegerc run 'siege.config' to generate a new .siegerc file **************************************************** root:/usr/local/bin# echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games root:/usr/local/bin# siege bash: /usr/bin/siege: No such file or directory root:/usr/local/bin# wtf!?!?   I'm on Ubuntu 12.04 using bash.  Also please note the warning output from siege is not relevant for the purposes of this question, as I am only interested in whether or not the program can be found and invoked.
3409
I just upgraded to OS X Lion and now cannot initialize Git where it used to work fine:  $ git add .  -bash: git: command not found   I'm new to Git and to programming, so I'm sure it's a quick fix, any help is greatly appreciated.  Thanks guys!
79725
I was installing Tor and wanted to access it directly from the terminal, so I was trying to copy start-tor-browser to /usr/bin. But by mistake, I have replaced the /usr/bin/env file with the start-tor-browser file. What should I do now??
42132
I’m using Mac OS X Yosemite and I want to be able to open Sublime Text 2 from the terminal with a command like this:  sublime .   I’ve typed this into terminal   ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" ~/bin/sublime   And also this variant:  ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/sublime   In the terminal, if I type in:  echo $PATH   I get:  /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin   I’ve tried editing my .bash_profile, right now it’s blank  After all this, I try sublime . and get the following error:     -bash: sublime: command not found   I’m completely new to Mac OS X, and terminal configuration, and am really struggling to figure out why I can't get it to work so any help would be appreciated.
30225
Last night, I migrated my MacBook's operating system from 10.10 "Yosemite" to 10.11 "El Capitan". Everything seemed to go smoothly. Happily, regarding my TeX-related work, I am able to use the GUI front ends "TeXworks" and "TeXshop" just fine since completing the OS upgrade. I use MacTeX2015, with all the latest updates installed.  Oddly, though, since completing the upgrade I can no longer run any MacTeX command-line utilities such as texdoc and kpsewhich. (Actually, as I just discovered, I can no longer run pdflatex either from a command line. However, I never do run pdflatex from a command line prompt, so that's not an urgent problem for me -- at least not for now.)  The suggestions given in the posting  do not seem to be applicable to this case, as they all seem to revolve around setting up /usr/texbin correctly -- /usr/texbin is no longer allowed under MacOSX 10.11. The document  by Herb Schulz deals in depth with adjusting settings in the GUI front ends, but it appears not to touch on what to do about /usr/texbin, which appears to be the now-missing link to TeX's command line utilities.   Pointers and solutions most welcome!
54243
I was looking at coreutils and found this as one of the files included as part of coreutils:  /usr/bin/[. What is [ and what does it do? It is an executable. I just don't know what it does or how to use it. $ file /usr/bin/[   /usr/bin/[: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared  libs), for GNU/Linux 2.6.15, stripped    When I try to run it, I think it is defaulting to the bash built in line expansion. Instead of actually running the file. $ &quot;/usr/bin/[&quot; /usr/bin/[: missing ‘]’ $ /usr/bin/\[ /usr/bin/[: missing ‘]’
1566
When I execute a program without specifying the full path to the executable, and Bash must search the directories in $PATH to find the binary, it seems that Bash remembers the path in some sort of cache. For example, I installed a build of Subversion from source to /usr/local, then typed svnsync help at the Bash prompt. Bash located the binary /usr/local/bin/svnsync for "svnsync" and executed it. Then when I deleted the installation of Subversion in /usr/local and re-ran svnsync help, Bash responds:  bash: /usr/local/bin/svnsync: No such file or directory   But, when I start a new instance of Bash, it finds and executes /usr/bin/svnsync.  How do I clear the cache of paths to executables?
102995
I'm a long time Linux user for over 15 years but one thing I hate with a passion is the mandated directory structure. I don't like that /usr/bin is the dumping ground for binaries or libs in /usr/lib, /usr/lib32, /usr/libx32, /lib, /lib32 etc... Random stuff in /usr/share etc. It's dumb and confusing. But some like it and tastes differ.  I want a directory structure where each package is isolated. Imagine instead if the media player dragon had it's own structure:  /software/dragon /software/dragon/bin/x86/dragon /software/dragon/doc/README /software/dragon/doc/copyright /software/dragon/lib/x86/libdragon.so   Or:  /software/zlib/include/zlib.h /software/zlib/lib/1.2.8/x86/libz.so /software/zlib/lib/1.2.8/x64/libz.so /software/zlib/doc/examples/... /software/zlib/man/...   You get the point. What are my options? Is there any Linux distro that uses something like my scheme? Can some distro be modified to work like I want it (Gentoo??) or do I need LFS? Is there any prior art in this area? Like publications on if the scheme is feasible or unfeasible?  Not looking for OS X. :) But OS X-inspired is totally ok.  Edit: I have no idea how PATH, LD_LIBRARY_PATH and other environment variables that depend on a small set of paths should work out. I'm thinking that if I have the KDE editor  installed in /software/kate/bin/x86/bin/kate then I'm ok with having to type the full path to the binary to start it. How it should work for dynamic libraries and dlopen calls, I don't know but it can't be an unsolvable engineering problem.
93739
I type echo $PATH on the command line and get  /opt/local/bin:/opt/local/sbin:/Users/andrew/bin:/usr/local/bin:/usr/local/mysql/bin:/usr/local/pear/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/git/bin  I'm wondering where this is getting set since my .bash_login file is empty.  I'm particularly concerned that, after installing MacPorts, it installed a bunch of junk in /opt. I don't think that directory even exists in a normal Mac OS X install.  Update: Thanks to  for correcting my echo $PATH statement
99309
I have Git for Windows installed on a Windows 7 machine (no, sadly I can't switch to W10 on this particular machine). This comes with a bash environment that uses MinGW-64 but only includes some binaries. I'd like to add more, such as GCC.  It seems like there should be someway of adding to the MinGW-64 binaries within the git bash instead of adding a whole other MSYS2/MinGW-64 install. However I'm not exactly clear on what is the best way to go about enabling this. I have tried installing  in the bash install usr/ directory (seemed like the place all the other binaries were). It seems to run OK but it doesn't seem to add anything AFAICT, no executables, no folders, nada... except if I try to run the install again it complains that there are already files there... though they patently aren't.  Thus my question is this: can I use win-builds or some other binary to achieve my aim and if so, how?  Note: There are several questions about this around the net and SE, but most are quite old and so no longer relevant AFAICT due to changes in MSYS2, MinGW and Git for Windows.
64038
I have a user that has made no modifications to the $PATH in any dot-files: it is exactly the system default setting. From a login shell:  $ ssh example.com user@example.com:~$ cat /tmp/hello.hs #!/bin/bash  echo "$SHELL" echo "$PATH"  user@example.com:~$ /tmp/hello.hs /bin/bash /usr/local/bin:/usr/bin:/bin   Exactly as specified in /etc/profile. This I find rather unexpected:  $ ssh example.com '/tmp/hello.sh' /bin/bash        /usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games   Like I said, there's no modification of $PATH in ~/.bashrc, nor in /etc/bash.bashrc. No ~/.ssh/environment either. The ssh(1) declares that the environment variable PATH is     Set to the default PATH, as specified when compiling ssh.   but  from StackOverflow and this  article suggest that I should be able to influence the $PATH for a given command simply by modifying /etc/profile, one of the shell startup files, etc.   What's going on here?
97609
So I uninstalled cmake, and reinstalled it with an updated version, and the path is correct, and the file is there, but whenever I try to run cmake, bash echoes -bash: /usr/bin/cmake: No such file or directory  pi@raspberrypi /usr/local/bin $ dir cmake  cpack  ctest  indiecity  pi@raspberrypi /usr/local/bin $ export | grep PATH declare -x PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games"
60999
Whatever I try to run, I get the error:   The command could not be located because '/usr/bin' is not included in the PATH environment variable.   I had some modification in my .bashrc file but then removed the two additional lines afterwards. However somehow the PATH variable seems to have been destroyed.
89995
If I have a PATH variable that (when exploded onto multiple lines) contains something like this (with a few notes added by me):  /Users/brandon/.rvm/gems/ruby-2.0.0-p353/bin /Users/brandon/.rvm/gems/ruby-2.0.0-p353@global/bin /Users/brandon/.rvm/rubies/ruby-2.0.0-p353/bin /opt/local/bin /opt/local/sbin /usr/local/sbin /usr/local/bin   # &lt;&lt;--- notice this path appears again later /usr/bin         # &lt;&lt;--- notice this comes AFTER /usr/local/bin /bin /usr/sbin /sbin /usr/local/bin   # &lt;&lt;--- here it is again! /usr/local/git/bin /Users/brandon/bin /Users/brandon/.homebrew/bin /usr/local/mysql/bin /usr/local/share/npm/bin /Applications/Postgres93.app/Contents/MacOS/bin /Users/brandon/.rvm/bin   is it possible for the presence of the second /usr/local/bin/ to cause the /usr/bin to take precedence over /usr/local/bin?  This seems crazy (to me: I've never heard of such a thing) but that's exactly the behavior I'm seeing.  I've just installed PHP with Homebrew, and yet the system PHP (from /usr/bin) is taking precedence:  $ which php /usr/bin/php   BUT, after manually altering the PATH (rather than digging through all the files sourced by my .zshrc to try to figure out why &amp; where the duplication is coming from) to remove the second instance of /usr/local/bin, I find that /usr/local/bin is taking precedence over /usr/bin as I would have expected it to in the first place:  $ which php /usr/local/bin/php   What would cause this?  Is this normal?
83219
I've installed Xcode and MacPorts on a brand new mid-2013 MacBook Air, but MacPorts doesn't work, saying that it cannot find anything.  mba:~ cnst$ sudo port install wget Warning: The Command Line Tools for Xcode don't appear to be installed; most ports will likely fail to build. Warning: See http://guide.macports.org/chunked/installing.xcode.html for more information. ---&gt;  Computing dependencies for wgetError: Unable to execute port: can't read "build.cmd": Failed to locate 'make' in path: '/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin' or at its MacPorts configuration time location, did you move it? mba:~ cnst$   And, indeed, there is no make or clang in the path, but it is definitely installed, though:  mba:~ cnst$ find /Applications -name "clang" -or -name "make" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang /Applications/Xcode.app/Contents/Developer/usr/bin/make mba:~ cnst$   Why is there no make or clang in the path?  Why MacPorts doesn't work?  I notice that  mentions that you have to install something from ADC, Apple Command Line Developer Tools, but ADC doesn't work since last Thursday or Friday due to their security breach, so, the developer tools are nowhere to be found.  What's the proper solution here?
84656
I'm wondering if $PATH cascades entries. You'll all need to take a leap of faith with me here, but here it goes.  Let's say we have a Java executable at /usr/bin/java but this version is very old and outdated. Unfortunately, we don't have su access so we can't just replace it. We can, however, download the current version of the JRE/JDK locally and point to the updated version. My question is, how does bash handle the case where we have two or more executables with the same name but in two or more different locations? Does bash somehow choose which one to execute when we type java into the console? Assuming /usr/bin has many other executables that we need, how would the $PATH look for something like this to work correctly?  Ideally, when we type java -version we should see:  java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)   instead of  java version "1.7.0_45" Java(TM) SE Runtime Environment (build 1.7.0_45-b18) Java HotSpot(TM) Client VM(build 24.45-b08, mixed mode, sharing)   I'm sure this question has been asked before and has some type of jargon associated with it. I've poked around SE, SO, and some forums but didn't find anything conclusive.
870
We used to use /etc/environment to set system-wide environment variables on Mountain Lion. However, it seems this file is no longer read. Ideally the solution should apply to all users, and we need it to work with ssh console sessions. So we need this to work ssh user@mavericks-machine 'echo $MY_ENV_VAR'  So far we've tried:  /etc/launchd.conf Works for all users, but only applies to 'windowed' applications, i.e. works in Terminal, but not in an ssh session.  ~/.profile, ~/.bash_profile etc. Only applies to shells   Any suggestions?