Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6703535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T07:10:58+00:00 2026-05-26T07:10:58+00:00

How is it possible that the binary executed ‘by default’ — ie. the first

  • 0

How is it possible that the binary executed ‘by default’ — ie. the first one found in my path, as returned by the which command, is in fact not the binary actually being executed by default? (I’m running Mac OS X 10.5 on a 2008 MacBook Pro.)

I just installed the latest version of git by running brew install git

It installed the new version in a location higher or earlier in my path than the old binary. However, the new version is not executed by default. It’s as if the shell had cached the location of the binary before I installed the new one – but the which command parses the path every time it runs.

I’d like to understand what’s going on here and learn how to flush the ‘cache’ without having to log out or restart the machine. This is what I’m seeing:

which git

returns

/usr/local/bin/git

while

git --version

returns

git version 1.6.5

but

/usr/local/bin/git --version

returns

git version 1.7.7

Checking further,

which -a git

returns

/usr/local/bin/git
/usr/local/git/bin/git
/usr/local/bin/git
/usr/local/git/bin/git
/usr/local/bin/git
/usr/local/git/bin/git

(yeah – there’s some redundancy in my path setup.)

/usr/local/git/bin/git --version

returns

git version 1.6.5

UPDATE — here’s the answer bash hashes. (from: In bash, "which" gives an incorrect path – Python versions )

type git

git is hashed (/usr/local/git/bin/git)

$ hash -d git

$ type git
git is /usr/local/bin/git

$ which git
/usr/local/bin/git

git --version
git version 1.7.7
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T07:10:58+00:00Added an answer on May 26, 2026 at 7:10 am

    Within a given instance of the shell, paths for binaries are indeed cached. The simplest way to clear this is to just open a new terminal window. But you can clear it in an existing window too by using the hash shell built-in (read help hash for details).

    As for why which disagrees with the shell about the binary to execute, it’s because which is a program that lives at /usr/bin/which and parses the PATH independently of the shell. If you want to see exactly what the shell is seeing, use type instead of which (and use type -a to see all possible results for a given command).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I discovered that it is possible to extract the hard-coded strings from a binary.
Is it possible to read binary MATLAB .mat files in Python? I've seen that
Is it possible that Microsoft will be able to make F# programs, either at
How is it possible that .NET is finding the wrong MyType in this scenario?
Is it possible that using jQuery, I cancel/abort an Ajax request that I have
Is it possible that when you have a webpage, when you open the PDF,
It is quite possible that I may not have got the point, but I
is it possible that my mingw 3.4.5 installation is faulty? or is this provided
It's possible that I'm not really understanding how git works here, but I have
Is it possible that the html page loaded, cannot be refreshed or reloaded by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.