5

I've had a working installation of adb and fastboot (for Android debugging and development). It used to be that when I type adb it launches the command line help for adb. Now it says this: bash: /usr/local/bin/adb: No such file or directory as if it's only looking for it in /usr/local/bin/adb, right? Though I still do have it in /usr/bin/adb and can still use it by typing the absolute path.

Further more, I have several aliases in my Bash Aliases file; one of which is sysupgrade (it does what it sounds like) but when I tried this today, it failed. So I ran the next lines in terminal interpreting some help wrong on a forum which says to put it in /etc/profile:

PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin"
export PATH

But my aliases now work! It's just that adb and fastboot don't. I've tried which and nping which are all in /usr/bin and they all work.

Update

Output of echo $PATH

/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games

Update 2

hash -r didn't show anything. But hash showed:

hits    command
   1    /usr/local/bin/adb
1
  • 2
    Give hash -r a try.
    – Cyrus
    Feb 24, 2016 at 20:32

2 Answers 2

4

adb was hashed at /usr/local/bin/adb, meaning the shell remembered its location and wouldn't look again in the PATH to see that it had been deleted/moved. Normally hash -r would unhash everything including adb, but it didn't in this case - not sure why, but running hash -d adb would also do it. Restarting the shell also unhashes everything.

If you had run type adb before fixing the issue, you would have seen this:

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

This is one of the reasons why type is better than which.

1

I still can't pinpoint the root cause of the problem but I fixed it after some trial and error.

I did which adb and which fastboot

which showed: /usr/local/bin/adb and /usr/local/bin/fastboot

And I simply did sudo rm /usr/local/bin/adb and sudo rm /usr/local/bin/fastboot

exit terminal/restart and I'm good to go.

Now adb and fastboot correctly execute /usr/bin/adb and /usr/bin/fastboot

1
  • 2
    which is useless for debugging this. The type builtin would've told you what was really going on.
    – geirha
    Mar 2, 2016 at 8:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .