Having changed my office laptop to a MacBook Pro, I noticed that there were quite a lot of options that were disabled for some internal IT reasons. One such feature, which I like and use the most in Mac is the Spotlight feature.
Here's the steps that I followed to enable the feature, without having to reach my very busy IT team.
The first thing to check if SpotLight is enabled is to look at the file /etc/hostconfig
Check if the highlighted property "SPOTLIGHT" is enabled in this file. If not, add it.
AFPSERVER=-NO- AUTHSERVER=-NO- TIMESYNC=-NO- QTSSERVER=-NO- SPOTLIGHT=-YES-
After you have verified the hostconfig, check if the file ".metadata_never_index" is there in the root directory. If the file exist, delete it. This is a ZERO byte file but exist just to disable the index functionality.
d--x--x--x 8 root wheel 272 Oct 3 07:22 .DocumentRevisions-V100 drwxr-xr-x 2 root wheel 68 Jul 26 02:20 .PKInstallSandboxManager drwx------ 5 root wheel 170 Oct 1 14:15 .Spotlight-V100 d-wx-wx-wt 3 root 100035085 102 Oct 1 14:23 .Trashes drwx------ 5 root wheel 170 Oct 1 14:21 .com.apple.NetBootX ---------- 1 root admin 0 Jun 21 03:17 .file drwx------ 27 root wheel 918 Oct 4 15:15 .fseventsd -rw------- 1 root wheel 65536 Oct 1 14:15 .hotfiles.btree -rw-r--r-- 1 root wheel 0 Oct 1 15:26 .metadata_never_index drwxr-xr-x@ 2 root wheel 68 Jun 21 04:13 .vol drwxrwxr-x+ 51 root admin 1734 Oct 2 23:02 Applications drwxr-xr-x+ 63 root wheel 2142 Oct 3 09:19 Library drwxr-xr-x@ 3 root wheel 102 Oct 4 09:19 Network drwxr-xr-x+ 4 root wheel 136 Oct 1 14:48 System drwxr-xr-x 7 root admin 238 Oct 2 21:29 Users drwxrwxrwt@ 3 root admin 102 Oct 4 11:32 Volumes
Just to be on the safer side, I moved the file to my desktop.
$sudo mv .metadata_never_index ~/Desktop/
Now, having removed all the configurations that blocks indexing, just start the indexing using the below command:
$sudo mdutil -i on /
That's it, now I could see the Spotlight already started indexing :)