enable - macOS


The enable command in macOS is used to activate or deactivate shell built-ins or functions temporarily within a terminal session. Primarily, it allows users to override or revert to shell built-in commands, offering flexibility in shell behavior and script execution. This is particularly useful for scripting and automation tasks where customization of command behavior is needed.


The basic syntax for the enable command is:

enable [-a] [-dn] [-f filename] [name ...]


  • -a: Lists all built-in shell commands.
  • -d: Disables the named built-ins.
  • -n: Same as -d. It disables the specified built-ins.
  • -f filename [name …]: Enables built-ins from a dynamic object filename.

Names are the built-in commands or the functions to be enabled or disabled.


  • -a: List all built-ins, showing which are enabled and which are disabled.
  • -d, -n: Disable specified built-ins. This is useful when you want to ensure that scripts run commands that are external rather than built-in versions.
  • -f: Load built-ins from a file which allows extending shell capabilities dynamically.


  1. Displaying All Built-ins:
    List all available built-ins and their current status (enabled/disabled).

    enable -a
  2. Disabling a Built-in Command:
    Temporarily disable the built-in cd to force the shell to use any external cd command, if available.

    enable -n cd
  3. Enabling a Built-in Command:
    Re-enable the cd command after it has been disabled.

    enable cd
  4. Loading External Built-ins:
    Enable a custom built-in stored in a dynamic library file named myfuncs.so.

    enable -f myfuncs.so myfunc

Common Issues

  • Conflicts with External Commands: When disabling built-in commands, ensure that the external versions are in the user’s path to avoid command not found errors.
  • Dynamic Loading Failures: When loading functions from external files, make sure the file is compatible and correctly formatted to be recognized by the shell.


The enable command can be used in conjunction with shell scripts to change the behavior of the script dynamically based on the environment or other conditions.

Example in a script:


# Disable built-in `echo` to use the GNU `echo`
enable -n echo

# Code that depends on the GNU version of echo
/bin/echo -e "This is a \n test"

# Re-enable built-in `echo`
enable echo
  • type: Shows whether a command name is a built-in, function, or external file.
  • command: Allows ignoring function look-up to use either built-ins or external commands.

For more detailed information on enable and related functionality, refer to the Bash reference manual or the macOS terminal man pages (man bash).