7

When I'm trying to run terminal commands in recovery mode on my MacBook Pro, most commands just won't work even if I'm root (the last character of the default(PS1) prompt is a '#'). So why is this and can I fix it?

  • 2
    What commands are you trying to use while in recovery mode, some commands may be unavailable because it is essentially a stripped down version of macOS. – bret7600 Jul 6 '17 at 11:55
  • 2
    @bret7600 I tried to use env etc. but probably it's because of, as (at)Aniempje said, it only has the most basic stuff. – root Jul 6 '17 at 12:11
  • 1
    Apple has changed things significantly, so this general question will likely need to be replaced with ones specific to operating systems. Or we can focus on specific things and specific commands and errors to do specific things. That should be easier than making a Wikipedia article listing all the things that might or might not work in a matrix of five or more versions of the operating system. – bmike May 12 at 16:17
9

The recovery partition is a bare-bones version of macOS which can be used as for various things, such as installing macOS again or disable SIP (system integrity protection). To keep the recovery partition small, Apple decided to not include all CLI tools that are available in macOS.

For security reasons, not every user is able to access all files. The root user should be able to access all files and run all programs. It's a permission issue. However, he's not able to run programs that don't even exist on the recovery partition, so changing the user to root won't help you.

If you do want to use those programs, you shouldn't be using the recovery partition anyways but boot a standard macOS partition.

  • With SIP enabled, not even root can access all files and run all programs. – calum_b May 12 at 16:07
3

Terminal only provides a subset of commands while in Recovery mode, but it can't be fixed because that's Apple's design. I've done a little Googling to find out exactly what is disabled, but I found nothing definitive. I can surmise that some commands are disabled because they require certain macOS services which are not running in Recovery mode, as well as a host of kernel extensions not being loaded. The Recovery macOS is clearly a subset of the full macOS.

I would also surmise that the available commands are the ones only useful (per Apple's wisdom) during a system recovery, such as disabling SIP, disk utility, password resets, etc.

  • 3
    The "commands" aren't really "disabled" - they don't exist in the system's path (/bin:/sbin:/local/bin etc) to keep a low footprint. A lot of missing commands can be executed if you launch them from the main volume (e.g. /Volumes/Macintosh\ HD/usr/local/bin/...). Some commands in the main volume paths are not available/fail to launch because they rely on additional libs/frameworks which don't exist in the recovery system. – klanomath Jul 6 '17 at 17:21
-2

If you run into the issue again. Put your MBP into TARGET DISK MODE by holding down T and powering the computer on. Use Firewire to a machine that only needs to be a mac of some sort. When you connect the host computer you will see your MBP show up as an external disk or disks depending on your format.

You can then use the terminal and all of it's full collection of commands, full disk utility and any other repair apps to operate on your MBP while it lays on the operating table in Target Disk. When finished, unlink the Firewire and reboot into Recovery Mode for whatever finishing touches you want to make and or upgrade your system!

You must log in to answer this question.

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