bless - macOS


Overview

The bless command on macOS is used primarily to set the boot volume and to initiate a system reboot into macOS recovery, another partition, or network boot. It configures the firmware of a Mac (Open Firmware or EFI) to control the system boot process and startup disk behavior. This utility is particularly powerful for system administrators, developers, and technicians who manage Macintosh deployments or dual-boot environments.

Syntax

The basic syntax of the bless command is as follows:

bless --folder directory [options]

This is the most common usage, which sets a specific folder as the bootable target. However, bless is a versatile command with multiple options and parameters:

bless --device /dev/diskXsY --setBoot
bless --mount /Volumes/YourVolume --setBoot
bless --info /Volumes/YourVolume
bless --netboot --server bsdp://your.server.ip

Each use of bless depends greatly on the options used alongside it.

Options/Flags

  • --folder directory : Sets the specified folder as the default boot volume. Typically, this folder contains a boot loader and associated files.
  • --device /dev/diskXsY : Directly specifies a device as a boot target.
  • --setBoot : Marks the specified device or volume as the boot volume.
  • --mount /Volumes/YourVolume : Specifies a mount point for a volume or device to set as bootable.
  • --info /Volumes/YourVolume : Provides detailed information about the current boot options configured on the specified volume.
  • --netboot : Sets up a network boot using BSDP (Boot Service Discovery Protocol).
  • --server bsdp://your.server.ip : Specifies the server address for network booting.

Examples

  • Set a specific folder on a volume as bootable:
    bless --folder "/Volumes/Macintosh HD/System/Library/CoreServices" --setBoot
    
  • Configure a device as the boot target and reboot:
    bless --device /dev/disk1s2 --setBoot --nextonly --reboot
    
  • Display boot information for a specific volume:
    bless --info /Volumes/Macintosh HD
    
  • Enable a network boot from a specified server:
    bless --netboot --server bsdp://192.168.1.10
    

Common Issues

  • Permission Errors: The bless command requires administrative privileges. Use sudo to avoid permission issues.
  • Device Not Found: Ensure that the device or volume path provided is correct and that the device is actually connected.
  • Non-bootable Target: When setting a folder or device as bootable, make sure it contains the necessary boot-loader files.

Integration

The bless command can be paired with other macOS utilities for scripted setups or recovery processes:

# Create a backup disk image and then set it as bootable
hdiutil create -srcfolder /my-folder -volname BackupDrive mybackup.dmg
hdiutil attach mybackup.dmg
bless --mount /Volumes/BackupDrive --setBoot --file /Volumes/BackupDrive/usr/standalone/i386/boot.efi
  • hdiutil – Utility for manipulating disk images.
  • diskutil – Utility for managing disks, partitions, and volumes on macOS.

Additional resources and official Apple documentation can be found here.

This concise manual for the bless command should provide a clear understanding of its purpose, usage, and integration into larger workflows.