MacOS – What does “is not recognized as an internal or external command” error mean

command linemacosvirtualboxxcode

I have spun up a VM of OS X since my main user is not an admin and I need to do things that require admin access.

My end goal is to install the Xcode command line tools into a VirtualBox VM I created with OS X 10.11. Is there a way to do this?

I tried to run xcode-select --install, but I got this error:

'xcode-select' is not recognized as an internal or external command, operable program, or script file

But I get the same error (with the command name different) when I ran the whoami, scp, and clear commands. I get an error No current directory specified when I run the ls, and cd commands.

What can I do to narrow down the cause of these terminal errors inside my VM?

Best Answer

I would spin up a second VM taking careful note of the version of the installer you used to build it up (or document from where you got the VM image). For example, the Install OS X El Capitan installer dated October 12, 2015 installs build 15B41a of the OS.

After the first boot, document which command-line tools are broken. You don't need to sign in to the app store or install Xcode to run xcode-select --install as that should be bundled with the core OS.

As I commented, massive amounts of breakage is present if the following commands don't run:

  • ls
  • whoami

You can run the type command to make sure you at least have a viable set of these commands:

mac:~ me$ type ls
ls is /bin/ls
mac:~ me$ type xcode-select
xcode-select is /usr/bin/xcode-select
mac:~ me$ file `which ls`
/bin/ls: Mach-O 64-bit executable x86_64