apt install unable to locate executable
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
Related videos on Youtube
Nutmeg
Updated on July 26, 2021Comments
-
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 DeeI 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 finallyman apt
, much to my surprise, I found it was a Java tool and not at package management tool! Wow!
-
-
Nutmeg almost 8 yearsI tried JAVA_HOME=$(readlink -f /usr/bin/java | sed "s:bin/java::") in a terminal console and it returned "readlink: illegal option -- f."
-
Nutmeg almost 8 yearsI 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/Commands/java/bin/apt" (-1)
-
Nutmeg almost 8 yearsI've tried to follow this path, and Commands/java is not a directory.
-
eheller almost 8 yearsOk, 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 almost 8 yearsEdit .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 almost 8 yearsHi 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/Home. 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)"