Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
99 lines (69 sloc) 2.26 KB


Use the spotlight resource to manage the metadata indexing state for disk volumes. This will primarily affect the ability to search volume contents with the macOS Spotlight feature. Under the hood, the spotlight resource executes the mdutil command in the metadata_util library.


The most basic usage of the spotlight resource declares a disk volume as the name property to enable metadata indexing:

spotlight '/'

The full syntax for all of the properties available to the spotlight resource is:

spotlight 'volume name' do
  volume                      String # defaults to 'volume name' if not specified
  indexed                     TrueClass, FalseClass # defaults to TrueClass if not specified
  searchable                  TrueClass, FalseClass # defaults to TrueClass if not specified


This resource has the following actions:


      Set the metadata indexing state declared by the indexed property. This is the only, and default, action.



      Ruby Type: String

      The name of the disk volume to manage.


      Ruby type: TrueClass, FalseClass

      Whether or not the desired state of the named disk volume is to be indexed.


      Ruby type: TrueClass, FalseClass

      Disables Spotlight searching if the index has already been created for the volume. Only applicable if the indexed property is set to false.


Enable indexing on the boot volume

spotlight '/'

Disable indexing on 'test_disk1'

spotlight 'test_disk1' do #
  indexed false

Enable indexing on a different volume

spotlight 'enable indexing on TDD2' do
  volume 'TDD2'
  indexed true

Disable indexing and prevent searching

spotlight 'disable indexing and prevent searching index on TDD-ROM' do
  volume 'TDD-ROM'
  indexed false
  searchable false
You can’t perform that action at this time.