How to use the command 'bless' (with examples)

How to use the command 'bless' (with examples)

  • Osx
  • December 25, 2023

The ‘bless’ command is used to set volume boot capability and startup disk options on a Mac. It can be used to bless a volume with Mac OS X or Darwin, set a volume as the active boot volume, enable NetBoot and broadcast for an available server, and gather information about the currently selected volume.

Use case 1: Bless a volume with only Mac OS X or Darwin, and create the BootX and boot.efi files as needed.

Code:

bless --folder /Volumes/Mac OS X/System/Library/CoreServices --bootinfo --bootefi

Motivation: This use case allows the user to bless a volume with Mac OS X or Darwin by specifying the folder containing the necessary files. The ‘bootinfo’ flag is used to create the BootX file, which is needed for booting Mac OS X, and the ‘bootefi’ flag is used to create the boot.efi file, which is needed for booting Darwin.

Explanation:

  • --folder /Volumes/Mac OS X/System/Library/CoreServices: Specifies the path to the folder that contains the necessary files for booting Mac OS X or Darwin.
  • --bootinfo: Creates the BootX file, which is needed for booting Mac OS X.
  • --bootefi: Creates the boot.efi file, which is needed for booting Darwin.

Example output: The BootX and boot.efi files will be created in the specified folder (/Volumes/Mac OS X/System/Library/CoreServices) if they don’t already exist.

Use case 2: Set a volume containing either Mac OS 9 and Mac OS X to be the active volume.

Code:

bless --mount /Volumes/Mac OS --setBoot

Motivation: This use case allows the user to set a volume containing both Mac OS 9 and Mac OS X as the active boot volume. This can be useful if the user wants to switch between the two operating systems.

Explanation:

  • --mount /Volumes/Mac OS: Specifies the path to the volume that contains both Mac OS 9 and Mac OS X.
  • --setBoot: Sets the specified volume as the active boot volume.

Example output: The specified volume (/Volumes/Mac OS) will be set as the active boot volume.

Use case 3: Set the system to NetBoot and broadcast for an available server.

Code:

bless --netboot --server bsdp://255.255.255.255

Motivation: This use case allows the user to enable NetBoot and broadcast for an available server. NetBoot is a feature that allows Macs to boot from a network server, which can be convenient in environments where multiple Macs need to be setup or updated.

Explanation:

  • --netboot: Enables NetBoot mode.
  • --server bsdp://255.255.255.255: Specifies the server to broadcast for. In this example, the broadcast is sent to all available servers (255.255.255.255).

Example output: The system will be set to NetBoot mode and a broadcast will be sent to all available servers.

Use case 4: Gather information about the currently selected volume (as determined by the firmware), suitable for piping to a program capable of parsing Property Lists.

Code:

bless --info --plist

Motivation: This use case allows the user to gather information about the currently selected volume. This can be useful for troubleshooting or scripting purposes, especially if the output is piped to a program capable of parsing Property Lists.

Explanation:

  • --info: Retrieves information about the currently selected volume.
  • --plist: Formats the output as a Property List, which is a structured format commonly used to represent data in macOS.

Example output: The output will be in the form of a Property List, containing information about the currently selected volume. This can include details such as the volume’s name, UUID, file system type, and more.

Tags :

Related Posts

How to use the command salt-run (with examples)

How to use the command salt-run (with examples)

Salt-run is a frontend command that allows for executing salt-runners on minions.

Read More
How to use the command atool (with examples)

How to use the command atool (with examples)

The atool command is a tool used for managing archives of various formats.

Read More
How to use the command `nix why-depends` (with examples)

How to use the command `nix why-depends` (with examples)

The nix why-depends command is used to show why a package depends on another package.

Read More