9

Having some trouble using apt on my Mac. If I run sudo apt search or sudo apt-get I get this error in the terminal:

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

I am running Sierra 10.12.4 and am trying to use the md5sum command on Mac.

Any thoughts on this?

bchards
  • 193
  • 1
  • 1
  • 5
  • 3
    When did Mac start supporting apt ? The apt utils are from Debian Linux. – ivanivan Apr 15 '17 at 18:07
  • I am not really sure, they may not, I just don't ever use things like that in terminal on the Mac. If I use the terminal I usually use Ubuntu, was just trying to get md5sum to word on Mac @ivanivan – bchards Apr 15 '17 at 18:12
  • If this seems like a rookie mistake, I assure you it's not. I type sudo apt install all the dang time on my Mac, in spite of having used MacPorts for probably 10 years and Debian for even longer. Too bad /usr/bin/apt is apparently protected by SIP, otherwise I'd probably just remove it to save the aggravation. – Kevin E Nov 23 '22 at 16:40

2 Answers2

9

apt, the package manager, is a Linux tool, from Debian GNU/Linux. macOS does not have it. The apt program that happens to be in your search path is Java's annotation processing tool, and will not do what you want.

There are projects like Homebrew, MacPorts and Fink that provides packaged third-party software for macOS.

NetBSD's pkgsrc also works nicely on macOS: http://www.pkgsrc.org/

As for md5sum: On the BSD Unices, of which macOS is one, there is often a utility called md5 available that performs the same service (but with slightly different format of output).

If you install GNU coreutils using the tools provided by one of the above projects, md5sum will be installed. The executable is sometimes called gmd5sum (note the added g prefix, which also gets added to all other GNU coreutils executables).

Kevin E
  • 468
Kusalananda
  • 333,661
  • Okay, that makes a lot of sense, I think that I am going to have a look into Homebrew for the future, but have just read the manual for md5, does the job I wanted, thank you! – bchards Apr 15 '17 at 18:30
4

macOS doesn’t use the APT package management tools, at least not by default. Here you’re ending up trying to run Java’s annotation processing tool.

If you want to check out package management tools on macOS, see How to install apt-get or YUM on Mac OS X; Fink allows you to install apt-get.

Stephen Kitt
  • 434,908
  • Thanks for explaining what /usr/bin/apt actually is on macOS. Do you know if that's there for a "factory" Mac installation, or does installing the Java JRE or whatever put it there? – Kevin E Nov 21 '22 at 16:10
  • @TheDudeAbides I’m afraid I don’t know, and I don’t have a current Mac handy, so I can’t check either. – Stephen Kitt Nov 21 '22 at 16:35
  • 1
    I wasn't able to sudo rm /usr/bin/apt, presumably because of SIP, so I guess it's part of the factory install. – Kevin E Nov 21 '22 at 17:53