apt install unable to locate executable

29,747

Solution 1

Hey I encountered this when trying to install libsndfile. Turns out I was reading their instructions for Debian/Ubuntu. apt isn't a thing on macosx. You'll want to use an alternative package installer like brew.

https://unix.stackexchange.com/questions/359219/error-when-using-apt-on-macos-sierra

Solution 2

export JAVA_HOME should point to the directory where the JDK or JRE is installed.

JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") in a console or directly in .bashrc should do the trick under debian

Share:
29,747

Related videos on Youtube

Nutmeg
Author by

Nutmeg

Updated on July 26, 2021

Comments

  • Nutmeg
    Nutmeg over 2 years

    I have read a few other threads similar to this one on stack overflow, but I've been unable to solve my problem.

    I am trying to install a package.

    apt install libgnutls28-dev
    

    however, I get the following error.

    Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/apt" (-1)
    

    Other people have been able to solve this error by setting the java home environment variable in the terminal.

    export JAVA_HOME=/Library/Java/Home
    

    I have tried this, and then run apt install again, but recieved the same error:

    Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home/bin/apt" (-1)
    

    Any help is appreciated!

    • Becca Dee
      Becca Dee
      I know this question is way old, but I found it just recently, as I was getting the same error. Were you trying to use apt in the sense of the Linux package manager or apt in the sense of the Java annotated processing tool? I just spent an inordinate amount of time trying to get rid of and reinstall ALL package managers after a rough upgrade to High Sierra, and couldn't figure out why apt was still there AND wasn't where the package managers should have put it. When I ran finally man apt, much to my surprise, I found it was a Java tool and not at package management tool! Wow!
  • Nutmeg
    Nutmeg almost 8 years
    I tried JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") in a terminal console and it returned "readlink: illegal option -- f."
  • Nutmeg
    Nutmeg almost 8 years
    I installed greadlink because I am running on OS X. When I run apt install now, it gives a different error: Unable to locate an executable at "/System/Library/Frameworks/JavaVM.framework/Versions/A/Comm‌​ands/java/bin/apt" (-1)
  • Nutmeg
    Nutmeg almost 8 years
    I've tried to follow this path, and Commands/java is not a directory.
  • eheller
    eheller almost 8 years
    Ok, sorry I didn't know you were running on OS X. Apple recommends setting JAVA_HOME to /usr/libexec/java_home in ~/.bash_profile
  • eheller
    eheller almost 8 years
    Edit .bash_profile with your favourite editor (for example "vim .bash_profile" in console) and add this line if it doesnt exist "export JAVA_HOME=$(/usr/libexec/java_home)". You can check if everything worked well by entering echo JAVA_HOME IN your terminal, which should output something like /Library/Java/JavaVirtualMachines/1.7.0.jdk
  • Nutmeg
    Nutmeg almost 8 years
    Hi eheller. Thank you for being patient with me. I added "export JAVA_HOME=$(/usr/libexec/java_home)" to my .bash_profile. echo $JAVA_HOME returns /Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/H‌​ome. Just as you said it would. However, apt install <package> returns "Unable to locate an executable at "/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/‌​Home/bin/apt" (-1)"

Related